/*
 * baltoro.dev holding page. Design: design/stub/SPEC.md (variant C1) in the monorepo.
 *
 * Colors, radii and shadows come from tokens.css, a copy of the canon. No hex is declared
 * here: a color that has no role is a reason to add a role, not to write a value.
 * Typography is this page's own — one Sora throughout (design/DECISIONS.md, Д-2).
 */

/*
 * Two subsets: latin and latin-ext. The second exists for Serbian Latin (č, ć, š, ž, đ);
 * without it those letters fall through to the fallback font and the line looks set in a
 * different typeface. unicode-range keeps latin-ext off the wire for everyone else.
 */
@font-face {
  font-family: 'Sora';
  src: url('/fonts/sora-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Sora';
  src: url('/fonts/sora-latin-ext-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: 'Sora';
  src: url('/fonts/sora-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Sora';
  src: url('/fonts/sora-latin-ext-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
/* Metric-matched fallback so the line does not jump while Sora loads. */
@font-face {
  font-family: 'Sora-fallback';
  src: local('Arial');
  size-adjust: 97%;
  ascent-override: 100%;
  descent-override: 28%;
  line-gap-override: 0%;
}

:root {
  --font: 'Sora', 'Sora-fallback', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fs-wordmark: 26px;
  --fs-tagline: 17px;
  --fs-fun: 13px;
  --gap-stack: 30px;
  --pad-page: 24px;
  --mark-size: 96px;
  --tagline-max: 300px;
  --hit: 44px;
}

@media (min-width: 768px) {
  :root {
    --fs-wordmark: 30px;
    --fs-tagline: 19px;
    --mark-size: 112px;
    --tagline-max: 420px;
  }
}

@media (min-width: 1100px) {
  :root {
    --fs-wordmark: 34px;
    --fs-tagline: 22px;
    --fs-fun: 14px;
    --gap-stack: 34px;
    --pad-page: 32px 40px;
    --mark-size: 128px;
    --tagline-max: 560px;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--c-surface-page);
  color: var(--c-text-primary);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* Exactly one screen. Overflow is not forbidden — the content simply fits. */
.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: var(--pad-page);
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

/*
 * The mark is pinned to the middle of the screen and the text grows downward from it.
 *
 * Centring the whole block meant any change in tagline line count — switching language, for
 * instance — moved the mark. Two equal grid rows give an immovable midline: the mark sits at
 * the bottom of the upper row, the text starts at the top of the lower one.
 */
.center {
  flex: 1;
  display: grid;
  grid-template-rows: 1fr 1fr;
  justify-items: center;
  text-align: center;
  margin: 0;
}

.anchor {
  align-self: end;
}

.stack {
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-stack);
  padding-top: var(--gap-stack);
}

.mark {
  height: var(--mark-size);
  width: auto;
  /* The mark inherits the text color: one markup for both themes, no per-theme files. */
  color: var(--c-brand-ink);
}

.wordmark {
  margin: 0;
  font-size: var(--fs-wordmark);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--c-brand-ink);
}

.accent {
  color: var(--c-brand-accent);
}

.tagline {
  margin: 0;
  max-width: var(--tagline-max);
  font-size: var(--fs-tagline);
  line-height: 1.55;
  color: var(--c-text-body);
  text-wrap: pretty;
}

.fun {
  margin: 0;
  font-size: var(--fs-fun);
  line-height: 1.5;
  color: var(--c-text-muted);
}

@media (min-width: 1100px) {
  .tagline {
    line-height: 1.5;
  }
}

/* ---------- controls ---------- */

.ctrl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: var(--hit);
  min-height: var(--hit);
  padding: 0 12px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-input);
  background: transparent;
  color: var(--c-text-primary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition:
    border-color var(--motion-control),
    background-color var(--motion-control);
}

.ctrl:hover {
  border-color: var(--c-control-border-hover);
  background: var(--c-control-bg-hover);
}

.ctrl:active {
  background: var(--c-control-bg-active);
  transform: scale(0.97);
}

/* Keyboard only: a mouse click must not raise the ring. */
.ctrl:focus-visible,
.lang-list:focus-visible,
.option:focus-visible {
  outline: 2px solid var(--c-focus-ring);
  outline-offset: 2px;
}

/*
 * The caret, the theme icon and the tick are inline SVG rather than font characters.
 * Sora has no such glyphs at all, so they used to come from the fallback font: their size
 * and weight did not match the text beside them and depended on the reader's system.
 */
.caret {
  width: 10px;
  height: 10px;
  display: block;
  opacity: 0.7;
}

.theme-icon {
  width: 16px;
  height: 16px;
  display: block;
}

/* ---------- language picker ---------- */

.lang {
  position: relative;
}

.lang-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 10;
  margin: 0;
  padding: 6px;
  list-style: none;
  min-width: 190px;
  max-width: calc(100vw - 32px);
  background: var(--c-surface-raised);
  border: 1px solid var(--c-border-subtle);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-popover);
}

.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--hit);
  padding: 0 16px;
  border-radius: calc(var(--r-input) - 2px);
  color: var(--c-text-primary);
  font-size: 14px;
  cursor: pointer;
}

.option:hover {
  background: color-mix(in srgb, var(--c-brand-secondary) 14%, transparent);
}

.option[aria-selected='true'] {
  background: color-mix(in srgb, var(--c-brand-secondary) 20%, transparent);
}

.option .tick {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--c-brand-secondary);
}

.option:not([aria-selected='true']) .tick {
  visibility: hidden;
}

/* ---------- social links ---------- */

.socials {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.social {
  border: none;
  padding: 0;
  color: var(--c-text-muted);
}

.social:hover {
  color: var(--c-brand-ink);
  background: transparent;
}

/*
 * The official marks reduced to one color: X is a single glyph, Reddit is the bubble in the
 * text color with Snoo in the page color. The sizes differ deliberately — a dense round
 * bubble reads larger than a thin glyph at equal width.
 */
.icon-x {
  width: 17px;
  height: 17px;
}

.icon-reddit {
  width: 19px;
  height: 19px;
}

/*
 * Landscape on a phone: wide and short. The vertical composition does not fit there — the
 * bar, a 112px mark, three lines of tagline and the social row add up past a 390px viewport,
 * and the page started to scroll against its own promise of one screen.
 *
 * So the same pieces turn sideways: mark on the left, text on the right. It is the
 * composition of the share image, it uses the width that landscape has in excess, and it
 * reads as deliberate rather than squeezed.
 */
@media (orientation: landscape) and (max-height: 560px) {
  .center {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 34px;
    text-align: left;
  }

  .anchor,
  .stack {
    align-self: auto;
  }

  .stack {
    align-items: flex-start;
    gap: 14px;
    padding-top: 0;
    max-width: 60vw;
  }

  .mark {
    height: min(38vh, 132px);
  }

  .tagline {
    font-size: 16px;
    line-height: 1.5;
    max-width: none;
  }

  .fun {
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ctrl {
    transition: none;
  }
  .ctrl:active {
    transform: none;
  }
}
