/* Two State Studio — styles */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/archivo-latin.woff2") format("woff2");
  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;
}

/* ---------- Brand ---------- */

:root {
  --yellow: #ffcb05;
  --magenta: #e10786;
  --black: #0b0b0b;
  --white: #ffffff;

  --bg: var(--white);
  --fg: var(--black);
  --muted: #6b6b6b;
  --line: #e4e4e4;

  /* the two states of the mark */
  --seg: var(--yellow);
  --bar: var(--magenta);

  --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}
/* Dark: colours invert and the mark's two colours swap.
   With JS, data-theme is set from the saved choice (site.js).
   Without JS, the checkbox alone flips the system default. */
:root[data-theme="dark"],
:root:not(.js):has(#state:checked) {
  --bg: var(--black); --fg: var(--white); --muted: #9a9a9a; --line: #262626;
  --seg: var(--magenta); --bar: var(--yellow);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: var(--black); --fg: var(--white); --muted: #9a9a9a; --line: #262626;
    --seg: var(--magenta); --bar: var(--yellow);
    color-scheme: dark;
  }
  :root:not(.js):has(#state:checked) {
    --bg: var(--white); --fg: var(--black); --muted: #6b6b6b; --line: #e4e4e4;
    --seg: var(--yellow); --bar: var(--magenta);
    color-scheme: light;
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 3px solid var(--magenta); outline-offset: 4px; }

.page { max-width: 80rem; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 3.5rem); }

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

.mark .seg { fill: var(--seg); transition: fill 0.3s ease; }
.mark .bar { fill: var(--bar); transition: fill 0.3s ease; }

/* ---------- Header ---------- */

.site-header {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.75rem 0 1.5rem;
}
.logotype { display: block; height: 20px; width: auto; }
.logotype .m { fill: var(--magenta); }
.logotype .y { fill: var(--yellow); }
.site-footer .logotype .m, .site-footer .logotype .y { fill: var(--white); }

.brand { display: block; }

/* The mark is the switch. Tap it to flip light and dark; its colours show the current state. */
.switch { position: relative; display: inline-block; cursor: pointer; user-select: none; line-height: 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .mark { display: block; height: 20px; width: auto; opacity: 0.5; transition: transform 0.2s ease, opacity 0.2s ease; }
/* At rest the switch is monochrome: black in light, white in dark. Colour returns on hover as the hint. */
.switch .mark .seg, .switch .mark .bar { fill: var(--fg); }
.switch:has(input:focus-visible) .mark .seg { fill: var(--bar); }
.switch:has(input:focus-visible) .mark .bar { fill: var(--seg); }
/* Hover hint only where a real hover exists; touch screens keep :hover stuck after a tap. */
@media (hover: hover) {
  .switch:hover .mark { transform: translateY(-1px); opacity: 1; }
  .switch:hover .mark .seg { fill: var(--bar); }
  .switch:hover .mark .bar { fill: var(--seg); }
  .switch:active .mark { transform: translateY(1px); }
}
/* It fades in a beat after the hero has settled; sooner on pages without the hero. */
.switch { animation: fade-in 0.7s ease both; animation-delay: 0.3s; }
body:has(.hero) .switch { animation-delay: 1.6s; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Hero ---------- */

.hero {
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(13rem, 28vw, 24rem);
  column-gap: clamp(2rem, 5vw, 5rem);
  row-gap: 1.5rem;
  align-items: center;
  padding: clamp(3rem, 9vw, 7rem) 0 clamp(3rem, 8vw, 6rem);
}
.hero h1, .hero .lede { grid-column: 1; }
.hero-mark { grid-column: 2; grid-row: 1 / 3; }
@media (max-width: 52rem) {
  /* Phones: the mark keeps its place beside the headline, smaller; the statement runs full width below. */
  .hero {
    grid-template-columns: minmax(0, 1fr) clamp(5.5rem, 24vw, 8rem);
    column-gap: 1.25rem;
    row-gap: 1rem;
    padding-top: 2.5rem;
  }
  .hero-mark { grid-row: 1 / 2; align-self: center; }
  .hero .lede { grid-column: 1 / -1; margin-top: 1rem; }
}
.hero h1 {
  margin: 0;
  font-weight: 800;
  font-size: clamp(1.75rem, 8.2vw, 6rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}
.hero h1 .line { display: block; white-space: nowrap; }
.hero h1 .hi { color: var(--magenta); }
.hero .lede { margin: 0.5rem 0 0; max-width: 40ch; font-size: 1.1875rem; text-wrap: pretty; }
.hero .lede .hi { color: var(--magenta); font-weight: 500; }

.hero-mark { position: relative; z-index: -1; width: 100%; }
.hero-mark .segs { display: block; width: 100%; height: auto; }
.hero-mark .barsvg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- Section label ---------- */

.section-label {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0; padding: 0 0 0.75rem;
  border-bottom: 3px solid var(--fg);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
}
.section-label span { color: var(--muted); }

/* ---------- Products ---------- */

.products { list-style: none; margin: 0 0 clamp(4rem, 9vw, 7rem); padding: 0; }

.product {
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  grid-template-areas: "idx name" "idx blurb" "idx meta";
  gap: 0.5rem 0.75rem;
  padding: 1.5rem 0.75rem;
  margin: 0 -0.75rem;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.18s ease, color 0.18s ease;
}
.product:hover, .product:focus-visible {
  background: var(--yellow); color: var(--black); outline: none;
}
.product:hover .muted, .product:focus-visible .muted, .product:hover .idx { color: var(--black); opacity: 0.75; }
.product:hover .tag { border-color: var(--black); }
.product:hover .tag.dev { background: var(--black); border-color: var(--black); color: var(--yellow); }

.product .idx { grid-area: idx; font-weight: 700; color: var(--magenta); padding-top: 0.35rem; font-size: 0.875rem; letter-spacing: 0.06em; }
.product .name {
  grid-area: name; margin: 0;
  font-weight: 800; text-transform: uppercase; letter-spacing: -0.02em;
  font-size: clamp(1.75rem, 4.5vw, 3rem); line-height: 1;
}
.product .blurb { grid-area: blurb; margin: 0; max-width: 44ch; }
.product .meta {
  grid-area: meta; display: flex; align-items: center; gap: 1rem;
  font-size: 0.8125rem; letter-spacing: 0.02em; margin-top: 0.25rem;
}
.muted { color: var(--muted); }

.tag {
  display: inline-block; padding: 0.25rem 0.6rem;
  border: 2px solid currentColor;
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.3;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.tag.dev { background: var(--magenta); border-color: var(--magenta); color: var(--white); }

.arrow { margin-left: auto; font-weight: 700; font-size: 1.5rem; line-height: 1; transition: transform 0.2s ease; }
.product:hover .arrow { transform: translateX(0.4rem); }

@media (min-width: 52rem) {
  .product {
    grid-template-columns: 4rem 1fr 1fr 12rem;
    grid-template-areas: "idx name blurb meta";
    align-items: start; gap: 1rem 2rem;
    padding: 2.25rem 1.25rem; margin: 0 -1.25rem;
  }
  .product .meta { flex-direction: column; align-items: flex-end; justify-self: end; gap: 0.75rem; margin-top: 0.25rem; }
  .product .arrow { margin-left: 0; }
  .product .blurb { padding-top: 0.35rem; }
}

/* ---------- Contact (full-bleed yellow) ---------- */

.contact {
  background: var(--yellow);
  color: var(--black);
  margin: 0 calc(50% - 50vw);
  padding: clamp(3rem, 8vw, 6rem) 0;
}
.contact .inner { max-width: 80rem; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 3.5rem); }
.contact .section-label { border-color: var(--black); }
.contact .section-label span { color: rgba(0,0,0,0.55); }
.contact h2 {
  margin: 2rem 0 0.75rem;
  font-weight: 800; text-transform: uppercase; letter-spacing: -0.03em;
  font-size: clamp(2.5rem, 8vw, 6.5rem); line-height: 0.95;
}
.contact .email {
  display: inline-block;
  font-weight: 700;
  font-size: clamp(1.25rem, 3.5vw, 2.5rem);
  line-height: 1.2;
  border-bottom: 4px solid var(--black);
  transition: border-color 0.2s ease, color 0.2s ease;
  overflow-wrap: anywhere;
}
.contact .email:hover, .contact .email:focus-visible { color: var(--magenta); border-color: var(--magenta); outline: none; }
.contact .note { max-width: 44ch; margin: 1.25rem 0 0; color: rgba(0,0,0,0.7); }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--black); color: var(--white);
  margin: 0 calc(50% - 50vw);
  padding: 2rem 0 2.5rem;
  font-size: 0.8125rem;
}
.site-footer .inner {
  max-width: 80rem; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 3.5rem);
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem;
}
.site-footer .logotype { height: 14px; }
.site-footer .spacer { flex: 1 1 auto; }
.site-footer a:hover { color: var(--yellow); }
.site-footer .copy { color: #9a9a9a; }
@media (max-width: 52rem) {
  .site-footer .inner > a:first-child { flex-basis: 100%; }
}

/* ---------- Prose pages ---------- */

.prose { max-width: 42rem; padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(4rem, 9vw, 7rem); }
.prose h1 {
  margin: 0 0 0.5rem;
  font-weight: 800; text-transform: uppercase; letter-spacing: -0.03em;
  font-size: clamp(2.5rem, 7vw, 4.5rem); line-height: 0.95;
}
.prose .updated { margin: 0 0 3rem; color: var(--muted); font-size: 0.875rem; }
.prose h2 {
  margin: 2.5rem 0 0.5rem;
  font-weight: 800; text-transform: uppercase; letter-spacing: -0.01em;
  font-size: 1.125rem; color: var(--magenta);
}
.prose p, .prose li { margin: 0 0 1rem; }
.prose ul { padding-left: 1.25rem; }
.prose a { border-bottom: 2px solid var(--yellow); transition: border-color 0.2s ease; }
.prose a:hover { border-color: var(--magenta); }

/* ---------- Motion ---------- */

.reveal { animation: reveal 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 80ms); }
@keyframes reveal { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* The bar drops in from the top edge of the window on load. */
@keyframes bar-drop { from { transform: translateY(-100vh); } to { transform: none; } }
.hero-mark .barsvg { animation: bar-drop 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s both; }

/* The headline fades in and drops line by line, in step with the bar. */
@keyframes line-drop { from { opacity: 0; transform: translateY(-0.5em); } to { opacity: 1; transform: none; } }
.hero h1 .line { animation: line-drop 0.65s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(0.25s + var(--n, 0) * 0.13s); }

@media (prefers-reduced-motion: reduce) {
  .reveal, .hero-mark .barsvg, .hero h1 .line, .switch { animation: none !important; }
  *, *::before, *::after { transition: none !important; }
}
