/* ==========================================================================
   Circle of Kurds — homepage
   Tokens and geometry: DESIGN.md §1–§3 (Figma "Home", 1440 × 1024 frame).
   Every resting state lives here (collapsed / expanded / success, mountain
   dim); js/main.js only animates between them, so reduced motion and
   no-JS both land on the right layout.
   ========================================================================== */

:root {
  color-scheme: light;

  /* colour */
  --white: #FFFFFF;
  --ink: #151515;
  --vermilion: #C94724;
  --vermilion-hover: #B33E1F;
  --gold: #D7A629;
  --grey: #6A6A6A;
  --placeholder: #767676;
  --line: #CECECE;
  --line-hover: #B8B8B8;
  --pill-line: #D6D6D6;

  /* type */
  --serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* motion */
  --t-fast: 200ms;

  /* geometry — desktop (≥1200px); exact Figma values at 1440 × 1024 */
  --pad: clamp(24px, 6.1112vw, 88px);          /* side padding: 88px at 1440 */
  --top: clamp(128px, 20.0196vh, 272px);        /* headline top: 205px at 1024 tall */
  --col: 448px;                                 /* right column */
  --title-size: clamp(88px, 7.2223vw, 104px);   /* 104px at 1440 */
  --field-h: 56px;
  --field-gap: 14px;
  --btn-h: 56px;
  --mw: min(1284px, 89.1667vw);                 /* mountain canvas width: 1284px at 1440 */
  --m-bottom: 0.10098;                          /* share of --mw clipped below the page edge */
  --m-show: 0.2253;                             /* painted part above the page edge, as a share of --mw */
  --m-gap: 64px;                                /* least air between the copy and the painting */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--white);
}

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

p {
  margin: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Page shell: one viewport at desktop, the mountain anchored to its bottom
   -------------------------------------------------------------------------- */

.home {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden; /* fallback */
  overflow: clip;   /* clips the painting's lower edge and the mobile bleed, without a scroll container */
}

.home-inner {
  position: relative;
  z-index: 1;
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 760px) var(--col);
  justify-content: space-between;
  align-items: start;
  column-gap: 48px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--top) var(--pad) 0;
}

/* --------------------------------------------------------------------------
   Headline
   -------------------------------------------------------------------------- */

.home-title {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--title-size);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.025em; /* -2.6px at 104px */
  /* Optical size follows the font size ("opsz" 60 at 104px). That is what the Figma
     render shows: "opsz" 20 would set "Big ideas start" 611px wide instead of 546px. */
  font-optical-sizing: auto;
  font-kerning: normal;
}

.home-title .line {
  display: block;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Star
   -------------------------------------------------------------------------- */

.home-star {
  position: absolute;
  top: calc(var(--top) - 82px);   /* 123px at 1440 × 1024 */
  right: calc(var(--pad) + 48px); /* x = 1240 at 1440 */
  width: 64px;
  height: 76.8px;
  overflow: visible;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Right column
   -------------------------------------------------------------------------- */

.home-aside {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding-top: 93px; /* description box at y = 297 in Figma; +1px puts the browser's baseline where Figma draws it */
}

.home-desc,
.home-location {
  color: var(--grey);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.6;
}

.home-location {
  position: relative;
  margin-top: 18.4px;  /* y = 373 */
  padding-left: 43px;  /* text at x = 947 */
}

.home-location__icon {
  position: absolute;
  top: 50%;
  left: 4px;           /* x = 908 in Figma */
  width: 24px;
  height: 24px;
  margin-top: -12px;
  fill: currentColor;  /* #6A6A6A */
}

.signup-area {
  position: relative;
  margin-top: 34.2px;  /* y = 437 (35.2px in Figma, less the 1px baseline correction above) */
}

.follow {
  margin-top: 52px;    /* y = 545; always 52px below the form */
}

/* --------------------------------------------------------------------------
   Signup form
   Collapsed: [email 272][12][button 164]. Expanded: four 448px fields,
   14px apart, button right-aligned 22px below. The three extra fields sit
   at their expanded positions even when collapsed (out of flow, hidden),
   so revealing them never moves them.
   -------------------------------------------------------------------------- */

.signup {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: var(--field-gap);
  margin: 0;
}

.field {
  position: relative;
  isolation: isolate; /* keeps the outline's z-index local, so the moving button passes over it */
  height: var(--field-h);
  border-radius: 8px;
  background: var(--white);
}

.field--email {
  grid-column: 1;
  grid-row: 1;
}

.field--extra {
  position: absolute;
  top: calc((var(--field-h) + var(--field-gap)) * var(--i));
  right: 0;
  left: 0;
  visibility: hidden;
  opacity: 0;
}

.field--extra:nth-child(2) { --i: 1; }
.field--extra:nth-child(3) { --i: 2; }
.field--extra:nth-child(4) { --i: 3; }

.field__input {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: 400 16px/1.25 var(--sans);
  letter-spacing: 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.field__input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.field__input:-webkit-autofill,
.field__input:-webkit-autofill:hover,
.field__input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  transition: background-color 600000s 0s, color 600000s 0s;
}

/* The outline is drawn in three slices (left cap, middle, right cap) so the
   email field can grow 272 → 448 with transforms only: the middle scales,
   the right cap slides. Inset box-shadows give a true 1.5px focus ring
   (a 1.5px border would be snapped to 1px at 1× in Chrome). */
.field__frame {
  --bw: 1px;
  --bc: var(--line);
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.field__frame > span {
  position: absolute;
  top: 0;
  bottom: 0;
  transition: box-shadow var(--t-fast) ease-out;
}

.field__cap {
  width: 16px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 var(--bw) var(--bc);
}

.field__cap--l {
  left: 0;
  clip-path: inset(0 8px 0 0);
}

.field__cap--r {
  right: 0;
  clip-path: inset(0 0 0 8px);
}

.field__mid {
  right: 8px;
  left: 8px;
  box-shadow:
    inset 0 var(--bw) 0 0 var(--bc),
    inset 0 calc(var(--bw) * -1) 0 0 var(--bc);
  transform-origin: 0 50%;
}

@media (hover: hover) {
  .field:hover .field__frame {
    --bc: var(--line-hover);
  }
}

.field:focus-within .field__frame {
  --bw: 1.5px;
  --bc: var(--ink);
}

.signup__submit {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}

/* expanded */
.home.is-expanded .field--email {
  grid-column: 1 / -1;
}

.home.is-expanded .field--extra {
  position: relative;
  top: auto;
  right: auto;
  left: auto;
  grid-column: 1 / -1;
  visibility: visible;
  opacity: 1;
}

.home.is-expanded .field--extra:nth-child(2) { grid-row: 2; }
.home.is-expanded .field--extra:nth-child(3) { grid-row: 3; }
.home.is-expanded .field--extra:nth-child(4) { grid-row: 4; }

.home.is-expanded .signup__submit {
  grid-column: 2;
  grid-row: 5;
  margin-top: calc(22px - var(--field-gap)); /* 22px below the last field */
}

/* success */
.signup-success[hidden] {
  display: none;
}

.signup-success {
  outline: none;
}

.signup-success.is-overlay {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
}

.home.is-success .signup {
  display: none;
}

.signup-success__title {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-optical-sizing: auto;
}

.signup-success__text {
  margin-top: 8px;
  color: var(--grey);
  font-size: 16px;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Buttons and pills
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--btn-h);
  margin: 0;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  font: 500 16px/1 var(--sans);
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--t-fast) ease-out,
    transform var(--t-fast) ease-out;
}

.btn--primary {
  width: 164px;
  background: var(--vermilion);
  color: var(--white);
}

.btn--primary[aria-disabled="true"] {
  cursor: default;
}

.btn--primary:not([aria-disabled="true"]):active {
  transform: translateY(0);
}

.btn:focus-visible,
.pill:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.follow__list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  padding: 0 21px 2px 19px; /* label 1px up and 1px left: matches the Figma render */
  border-radius: 999px;
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--pill-line);
  color: var(--ink);
  font: 500 16px/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow var(--t-fast) ease-out;
}

.pill--luma {
  width: 192px;
}

.pill--instagram {
  width: 168px;
}

.pill__arrow {
  position: relative;
  top: -0.1875em; /* Inter 4 (Google Fonts) draws ↗ on the x-height; Figma's sits on the cap height */
  display: inline-block;
  margin-left: 0.28em;
  transition: transform var(--t-fast) ease-out;
}

@media (hover: hover) {
  .btn--primary:not([aria-disabled="true"]):hover {
    background: var(--vermilion-hover);
    transform: translateY(-1px);
  }

  .pill:hover {
    box-shadow: inset 0 0 0 1px var(--ink);
  }

  .pill:hover .pill__arrow {
    transform: translate(1px, -1px);
  }
}

.pill:focus-visible .pill__arrow {
  transform: translate(1px, -1px);
}

/* --------------------------------------------------------------------------
   Mountain watercolour
   The flex spacer reserves room for the painting below the copy; the art box
   is the full 2752×1536 canvas at --mw wide, centred, with --m-bottom·mw
   clipped below the page edge — at 1440 × 1024 that is a 1284×717 box at
   x 78, y 437 (the owner prefers this to Figma's later full-bleed version).
   -------------------------------------------------------------------------- */

.home-mountain {
  flex: 1 0 auto;
  min-height: calc(var(--mw) * var(--m-show) + var(--m-gap)); /* painting height above the fold + air */
  pointer-events: none;
}

.home-mountain__art {
  position: absolute;
  z-index: 0;
  bottom: calc(var(--mw) * var(--m-bottom) * -1);
  left: calc(50% - var(--mw) / 2);
  width: var(--mw);
  aspect-ratio: 2752 / 1536;
  pointer-events: none;
}

.home-mountain__shift,
.home-mountain__parallax,
.home-mountain__art picture {
  display: block;
  width: 100%;
  height: 100%;
}

.home-mountain__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
  -webkit-user-select: none;
  user-select: none;
}

/* --------------------------------------------------------------------------
   Entrance: held in the "before" state until js/main.js runs it (after the
   intro, or straight away). An inline <head> failsafe adds .home-ready if
   main.js never starts.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .js:not(.home-ready) .home-title .line,
  .js:not(.home-ready) .enter,
  .js:not(.home-ready) .home-star__enter,
  .js:not(.home-ready) .home-mountain__art {
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   ≥1200px: the expanded form overlaps the painting instead of pushing it,
   so the page never grows or jumps; the painting dims and drifts down.
   -------------------------------------------------------------------------- */

@media (min-width: 1200px) {
  .home.is-expanded .home-mountain {
    min-height: max(0px, calc(var(--mw) * var(--m-show) + var(--m-gap) - (3 * (var(--field-h) + var(--field-gap)) + 22px + var(--btn-h))));
  }

  .home.is-expanded .home-mountain__shift {
    opacity: 0.55;
    transform: translateY(40px);
  }
}

/* --------------------------------------------------------------------------
   768–1199px: stacked
   -------------------------------------------------------------------------- */

@media (max-width: 1199px) {
  :root {
    --top: clamp(120px, 16vh, 240px);
    --title-size: clamp(56px, 7.4vw, 88px);
    --mw: 110vw;
    --m-bottom: 0.10098;
    --m-show: 0.2253;
  }

  .home-inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-title {
    max-width: 11ch;
  }

  .home-aside {
    grid-column: 1;
    grid-row: 2;
    width: min(var(--col), 100%);
    padding-top: clamp(40px, 6vw, 64px);
  }

  .home-star {
    top: max(24px, calc(var(--pad) * 0.85));
    right: var(--pad);
    width: 48px;
    height: 57.6px;
  }
}

/* --------------------------------------------------------------------------
   ≤767px: phone (designed at 390 × 844)
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  :root {
    --pad: 24px;
    --top: 112px;
    --title-size: clamp(40px, 13.34vw, 52px);
    --field-h: 52px;
    --field-gap: 10px;
    --btn-h: 52px;
    --mw: 130vw;
    --m-bottom: 0.10098;
    --m-show: 0.2253;
    --m-gap: 40px;
  }

  .home-title {
    line-height: 1.06;
  }

  .home-star {
    top: 24px;
    right: 24px;
    width: 40px;
    height: 48px;
  }

  .home-aside {
    width: 100%;
    max-width: var(--col); /* full width on phones, never a 700px button on small tablets */
    padding-top: 32px;
  }

  .home-desc,
  .home-location {
    font-size: 16px;
  }

  .home-location {
    margin-top: 12px;
    padding-left: 32px;
  }

  .home-location__icon {
    left: 0;
    width: 22px;
    height: 22px;
    margin-top: -11px;
  }

  .signup-area {
    margin-top: 28px;
  }

  .signup {
    grid-template-columns: minmax(0, 1fr);
  }

  .signup__submit,
  .home.is-expanded .signup__submit {
    grid-column: 1;
    justify-self: stretch;
  }

  .signup__submit {
    grid-row: 2;
  }

  .home.is-expanded .signup__submit {
    grid-row: 5;
    margin-top: 6px;
  }

  .btn--primary {
    width: 100%;
  }

  .follow {
    margin-top: 40px;
  }

  .follow__list {
    gap: 10px;
  }

  .pill {
    height: 48px;
    padding: 0 22px 2px;
    font-size: 15px;
  }

  .pill--luma,
  .pill--instagram {
    width: auto;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion: no entrance; colour changes only.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .btn--primary:not([aria-disabled="true"]):hover,
  .pill:hover .pill__arrow,
  .pill:focus-visible .pill__arrow {
    transform: none;
  }

  .btn,
  .pill__arrow {
    transition: background-color var(--t-fast) ease-out;
  }

  .home.is-expanded .home-mountain__shift {
    transform: none;
  }
}

/* Spam trap: invisible to people and screen readers, filled in by bots. */
.signup__trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
