/*
  u7y home: the page's own styles, on top of the design system in
  vendor/opencode-site (tokens, shell, blocks). Only what the vendored sheets do not
  have: the sample cards, the phone menu, the pilot lists and form, the details-based
  FAQ and the footer wordmark. Colours, type sizes and spacing come from the tokens.
*/

/* ---------- Sample cards under the hero ---------- */

[data-site] [data-u7y="cards"] {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gutter);
  margin-top: 2.5rem;
}

[data-site] [data-u7y="cards"] article {
  min-width: 0;
}

[data-site] [data-u7y="cards"] [data-u7y="screen"] {
  aspect-ratio: 4 / 5;
  padding: 1.25rem;
  overflow: hidden;
  background: var(--fixed-dark-raised);
  color: var(--fixed-dark-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  line-height: 1.7;
}

[data-site] [data-u7y="cards"] pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

[data-site] [data-u7y="cards"] h2 {
  margin: 1rem 0 0;
  font-family: var(--font-mono);
  font-size: var(--title-size);
  font-weight: 400;
  line-height: 1.3;
  -webkit-text-stroke: var(--title-stroke);
  color: var(--text-strong);
}

[data-site] [data-u7y="cards"] article > p {
  margin: 0.375rem 0 0;
  color: var(--text);
  font-size: var(--body-size);
  line-height: 1.4;
  text-wrap: pretty;
}

[data-site] [data-u7y="cards-note"] {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  color: var(--text-faint);
}

@media (max-width: 40rem) {
  [data-site] [data-u7y="cards"] {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }

  [data-site] [data-u7y="cards"] [data-u7y="screen"] {
    aspect-ratio: 4 / 3;
  }
}

/* ---------- Feature list items that are not links ---------- */

[data-site] [data-component="features"] > li > div {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: inherit;
}

[data-site] [data-component="features"] > li > div > span {
  color: var(--text-weak);
}

/* ---------- Phone menu (no JavaScript): a details element in the top bar ---------- */

[data-site] [data-u7y="menu"] {
  display: none;
}

@media (max-width: 60rem) {
  [data-site] [data-u7y="menu"] {
    display: block;
    position: static;
  }

  [data-site] [data-u7y="menu"] summary {
    position: relative;
    display: block;
    width: 2.75rem;
    height: 2.75rem;
    margin-inline-end: -0.75rem;
    list-style: none;
    cursor: pointer;
  }

  [data-site] [data-u7y="menu"] summary::-webkit-details-marker {
    display: none;
  }

  [data-site] [data-u7y="menu"] [data-slot="line"] {
    position: absolute;
    inset-inline: 14px;
    top: calc(50% - 0.75px);
    height: 1.5px;
    background: var(--text-strong);
  }

  [data-site] [data-u7y="menu"] [data-slot="line"]:first-child {
    translate: 0 -3.5px;
  }

  [data-site] [data-u7y="menu"] [data-slot="line"]:last-child {
    translate: 0 3.5px;
  }

  [data-site] [data-u7y="menu"][open] [data-slot="line"]:first-child {
    rotate: 45deg;
    translate: none;
  }

  [data-site] [data-u7y="menu"][open] [data-slot="line"]:last-child {
    rotate: -45deg;
    translate: none;
  }

  /* The sheet covers the page under the bar, as one surface with it. */
  [data-site] [data-u7y="menu"] nav {
    position: fixed;
    inset: calc(var(--topbar-height) + env(safe-area-inset-top, 0px)) 0 0;
    z-index: 9;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg);
    margin: 0;
    padding: 0.5rem calc(var(--edge) + env(safe-area-inset-right, 0px))
      calc(1.5rem + env(safe-area-inset-bottom, 0px))
      calc(var(--edge) + var(--phone-logo-height, 30px) * 2 / 5 - 1.5ch + env(safe-area-inset-left, 0px));
    font-family: var(--font-mono);
    font-size: var(--fs-large);
    line-height: 24px;
  }

  [data-site] [data-u7y="menu"] nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  [data-site] [data-u7y="menu"] nav a {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 3.25rem;
    color: var(--text);
  }

  [data-site] [data-u7y="menu"] nav [data-slot="index"] {
    flex-shrink: 0;
    color: var(--text-muted);
  }
}

/* ---------- Pilot lists ---------- */

[data-site] [data-u7y="lists"] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem var(--gutter);
  max-width: var(--two-cards);
}

[data-site] [data-u7y="lists"] h3 {
  margin: 0 0 0.875rem;
  font-family: var(--font-mono);
  font-size: var(--title-size);
  font-weight: 400;
  line-height: 1.3;
  -webkit-text-stroke: var(--title-stroke);
  color: var(--text-strong);
}

[data-site] [data-u7y="lists"] ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

[data-site] [data-u7y="lists"] li {
  position: relative;
  padding-inline-start: 1.25rem;
  color: var(--text);
  line-height: 1.4;
  text-wrap: pretty;
}

[data-site] [data-u7y="lists"] li::before {
  content: "-";
  position: absolute;
  inset-inline-start: 0;
  color: var(--text-faint);
}

[data-site] [data-u7y="pilot-note"] {
  margin: 0;
  color: var(--text-weak);
}

@media (max-width: 40rem) {
  [data-site] [data-u7y="lists"] {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- FAQ: details and summary where the reference uses a button ---------- */

[data-site] [data-component="faq"] details[data-slot="faq-item"] {
  border-top: 1px solid var(--border);
}

[data-site] [data-component="faq"] li:first-child details[data-slot="faq-item"] {
  border-top: 0;
}

[data-site] [data-component="faq"] summary[data-slot="faq-question"] {
  list-style: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: inherit;
  color: inherit;
}

[data-site] [data-component="faq"] summary[data-slot="faq-question"]::-webkit-details-marker {
  display: none;
}

/* The vertical bar folds into the minus once the answer is open. */
[data-site] [data-component="faq"] details[open] > [data-slot="faq-question"]::after {
  scale: 0 1;
}

/* ---------- Dark band at the end of the page ---------- */

/* Under its label row, across the whole content width, with its text starting where the
   sections' body column starts. Dark in both themes, like the reference site's Console band. */
[data-site] [data-u7y="band"] {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1rem;
  min-height: 13rem;
  margin-top: 2.5rem;
  padding: 3rem 3rem 3rem calc(var(--card) + var(--gutter));
  background: var(--fixed-dark);
  color: var(--fixed-dark-text);
}

[data-site] [data-u7y="band"] h3 {
  margin: 0;
  max-width: 26rem;
  font-family: var(--font-sans);
  font-size: var(--fs-entry);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

[data-site] [data-u7y="band"] p {
  margin: 0;
  max-width: 34rem;
  color: var(--fixed-dark-muted);
  line-height: 1.4;
  text-wrap: pretty;
}

[data-site] [data-u7y="band"] [data-slot="actions"] {
  margin-top: 0.5rem;
}

[data-site] [data-u7y="band"] [data-component="site-button"] {
  background: var(--fixed-white);
  color: var(--fixed-ink);
}

@media (hover: hover) and (pointer: fine) {
  [data-site] [data-u7y="band"] [data-component="site-button"]:hover {
    background: var(--fixed-light);
  }
}

@media (max-width: 60rem) {
  [data-site] [data-u7y="band"] {
    padding: 2rem 1.5rem;
  }
}

/* ---------- Waitlist form (Chinese page) ---------- */

[data-site] [data-u7y="waitlist"] {
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

[data-site] [data-u7y="waitlist"] h3 {
  margin: 0 0 1.5rem;
  font-family: var(--font-mono);
  font-size: var(--title-size);
  font-weight: 400;
  line-height: 1.3;
  -webkit-text-stroke: var(--title-stroke);
  color: var(--text-strong);
}

[data-site] [data-u7y="waitlist"] form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem var(--gutter);
  max-width: var(--two-cards);
}

/* Choice groups take the whole row, so their options stay on one line. */
[data-site] [data-u7y="waitlist"] fieldset[data-u7y="field"] {
  grid-column: 1 / -1;
}

[data-site] [data-u7y="waitlist"] [data-u7y="field"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

[data-site] [data-u7y="waitlist"] [data-u7y="field"] > :is(label, legend) {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--text-strong);
}

[data-site] [data-u7y="waitlist"] :is(input[type="text"], input[type="email"], input[type="number"], select) {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  background: var(--bg);
  color: var(--text-strong);
  font-family: var(--font-sans);
  font-size: var(--fs-input);
}

[data-site] [data-u7y="waitlist"] :is(input, select):focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 1px;
}

[data-site] [data-u7y="waitlist"] fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

[data-site] [data-u7y="waitlist"] fieldset > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

[data-site] [data-u7y="waitlist"] :is(fieldset > div, [data-u7y="checks"]) label {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-height: 2.75rem;
  color: var(--text);
  line-height: 1.4;
  cursor: pointer;
}

[data-site] [data-u7y="waitlist"] input[type="checkbox"],
[data-site] [data-u7y="waitlist"] input[type="radio"] {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0.2rem 0 0;
  accent-color: var(--text-strong);
}

[data-site] [data-u7y="waitlist"] [data-u7y="checks"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  grid-column: 1 / -1;
  color: var(--text);
}

[data-site] [data-u7y="waitlist"] [data-u7y="checks"] small {
  display: block;
  margin-top: 0.5rem;
  color: var(--text-weak);
  line-height: 1.5;
}

[data-site] [data-u7y="waitlist"] [data-u7y="wide"] {
  grid-column: 1 / -1;
}

[data-site] [data-u7y="waitlist"] [data-u7y="hp"] {
  position: absolute;
  inset-inline-start: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

[data-site] [data-u7y="waitlist"] [data-slot="actions"] {
  grid-column: 1 / -1;
}

[data-site] [data-u7y="waitlist"] [data-component="site-button"] {
  height: 2.75rem;
}

[data-site] [data-u7y="waitlist"] [role="alert"] {
  grid-column: 1 / -1;
  margin: 0;
  color: light-dark(#a4262c, #ff99a0);
}

@media (max-width: 40rem) {
  [data-site] [data-u7y="waitlist"] form {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* A phrase that must not be split when the title wraps on a phone. */
[data-site] [data-u7y="keep"] {
  white-space: nowrap;
}

/* ---------- Plain pages (404, thanks) ---------- */

[data-site] [data-u7y="plain"] {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  max-width: 52rem;
}

[data-site] [data-u7y="plain"] h1 {
  margin: calc(0.3175em - 0.5lh) calc(0.3725em - 0.5lh);
  font-family: var(--font-mono);
  font-size: clamp(2.25rem, 4.4vw, 4rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

[data-site] [data-u7y="plain"] p {
  max-width: 34rem;
  font-size: var(--hero-copy-size);
  line-height: var(--hero-copy-leading);
  color: var(--text-weak);
  text-wrap: pretty;
}

[data-site] [data-u7y="plain"] [data-slot="actions"] {
  display: flex;
  gap: 0.5rem;
}

/* ---------- Footer wordmark: outlined letters instead of the drawn ones ---------- */

/* Three letters spread from edge to edge of the footer's second column, sitting on the
   copyright line's baseline. */
[data-site] [data-component="wordmark"] {
  margin-bottom: 0;
  margin-top: 3rem;
}

[data-site] [data-u7y="wordmark"] {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  font-family: var(--font-mono);
  font-size: clamp(6rem, 22cqw, 20rem);
  font-weight: 400;
  line-height: 0.74;
  color: transparent;
  -webkit-text-stroke: 1px var(--border);
}
