/* Brass Key — brasskey.app
 *
 * Colors are lifted from Sources/App/DesignSystem/Theme.swift so the site and
 * the app are the same product. Dark is Vault (near-black and brass); light is
 * Daylight (warm paper and sage). The site follows the reader's system setting
 * for the same reason the app defaults to Auto: nobody should have to think
 * about it.
 */

:root {
  --bg: #faf9f5;
  --surface: #ffffff;
  --hairline: #e4e1d8;
  --text: #1b1b18;
  --text-2: #6b6a64;
  --text-3: #8a8880;
  --accent: #3e6f63;
  --accent-soft: #eaf1ee;
  --on-accent: #ffffff;

  --measure: 34rem;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f11;
    --surface: #18181b;
    --hairline: #2a2a2e;
    --text: #f2efe8;
    --text-2: #8e8a80;
    --text-3: #6e6a62;
    --accent: #c89b4a;
    --accent-soft: #17140e;
    --on-accent: #14110c;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------------------------------------------------------------- layout */

.wrap {
  width: 100%;
  max-width: 62rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.prose { max-width: var(--measure); }

section { padding-block: clamp(3rem, 9vw, 5.5rem); }

/* ------------------------------------------------------------ typography */

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.012em;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.25rem, 6.5vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.1rem); margin-top: 2.2em; }
h3 { font-size: 1.2rem; margin-top: 2em; }
h2:first-child, h3:first-child { margin-top: 0; }

p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

.lead {
  font-size: clamp(1.15rem, 2.6vw, 1.35rem);
  line-height: 1.55;
  color: var(--text-2);
}

.eyebrow {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
}

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

strong { font-weight: 650; color: var(--text); }

ul { padding-left: 1.15em; margin: 0 0 1.15em; }
li { margin-bottom: 0.5em; }
li::marker { color: var(--accent); }

/* ---------------------------------------------------------------- header */

.masthead {
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  z-index: 10;
}

.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  flex-wrap: wrap;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.wordmark svg { display: block; flex: none; }

nav { display: flex; gap: clamp(0.9rem, 3vw, 1.6rem); font-size: 0.95rem; }
nav a { color: var(--text-2); text-decoration: none; }
nav a:hover, nav a[aria-current="page"] { color: var(--text); }

/* ------------------------------------------------------------------ hero */

.hero { padding-block: clamp(3.5rem, 11vw, 7rem) clamp(2.5rem, 8vw, 4.5rem); }
.hero h1 { margin-bottom: 0.45em; }

.pill {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--text-2);
  margin-bottom: 1.5rem;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.25rem;
  margin-top: 2rem;
}

.button {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 0.6rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}

.button:hover { filter: brightness(1.07); }

.button.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--hairline);
}

.note { font-size: 0.92rem; color: var(--text-3); }

/* -------------------------------------------------------------- features */

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 0.85rem;
  padding: 1.5rem;
}

.card h3 { margin: 0 0 0.45em; font-size: 1.1rem; }
.card p { color: var(--text-2); font-size: 0.97rem; margin: 0; }

.card-icon {
  width: 2rem; height: 2rem;
  margin-bottom: 0.9rem;
  color: var(--accent);
}

/* ------------------------------------------------------------- statement */

.statement {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: var(--accent-soft);
}

.statement p {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 3.4vw, 1.75rem);
  line-height: 1.4;
  max-width: 40rem;
}

/* ------------------------------------------------------------------ plan */

.plans { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }

/* ---- screenshots ---- */
.shots {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}
.shots.wide { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
/* Three phones under the headline; two beside a block of cards. Fixed
   column counts, so they stay a row and simply get smaller on a phone. */
.shots.strip { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 40rem; margin-top: 2.75rem; gap: 0.9rem; }
.shots.pair { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 30rem; margin: 2.5rem auto 0; }
.shot { margin: 0; }
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1.1rem;
  border: 1px solid var(--hairline);
  background: var(--surface);
}
.shot figcaption {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-2);
}
.plan { background: var(--surface); border: 1px solid var(--hairline); border-radius: 0.85rem; padding: 1.75rem; }
.plan.featured { border-color: var(--accent); }
.plan .price { font-family: var(--serif); font-size: 2rem; margin: 0.2em 0 0.1em; }
.plan .price span { font-family: var(--sans); font-size: 0.95rem; color: var(--text-2); font-weight: 400; }
.plan ul { margin-top: 1rem; }

/* ---------------------------------------------------------------- legal */

.legal-meta {
  font-size: 0.92rem;
  color: var(--text-3);
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
  margin-bottom: 2.5rem;
}

.legal h2 { font-size: 1.35rem; }

.plain {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 0.75rem;
  padding: 1.25rem 1.4rem;
  margin: 1.5rem 0;
}

.plain p { margin: 0; }

table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.97rem; }
th, td { text-align: left; padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--hairline); vertical-align: top; }
th { font-weight: 650; }
td:first-child { white-space: nowrap; padding-right: 1.5rem; }

/* ---------------------------------------------------------------- footer */

footer {
  border-top: 1px solid var(--hairline);
  padding-block: 2.5rem 3.5rem;
  color: var(--text-3);
  font-size: 0.92rem;
}

footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; }
footer nav { flex-wrap: wrap; }

/* ------------------------------------------------------- accessibility */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0.3rem;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: var(--gutter);
  top: 0.6rem;
  z-index: 20;
  background: var(--surface);
  padding: 0.6rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------- languages */

/* The picker sits at the end of the masthead, so it reads top right on every
 * page and stays there when the header sticks. A <details> disclosure keeps
 * seventeen languages out of the way without any JavaScript; the flag is
 * decoration and the language name is the label a screen reader announces. */

/* margin-inline-start:auto keeps it hard right in the masthead's flex row,
 * including when the row wraps on a narrow screen and the picker ends up
 * on a line of its own. */
.langpicker { position: relative; font-size: 0.85rem; margin-inline-start: auto; }

.langpicker summary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--hairline);
  border-radius: 0.5rem;
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
  -webkit-user-select: none;
  user-select: none;
}
.langpicker summary::-webkit-details-marker { display: none; }
.langpicker summary:hover { color: var(--text); border-color: var(--text-3); }
.langpicker summary::after {
  content: "";
  width: 0.38em;
  height: 0.38em;
  margin-inline-start: 0.15rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.12em) rotate(45deg);
}
.langpicker[open] summary::after { transform: translateY(0.08em) rotate(-135deg); }

.langpicker .langmenu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 0.45rem);
  z-index: 20;
  display: grid;
  gap: 0.05rem;
  min-width: 12.5rem;
  max-height: min(70vh, 24rem);
  overflow-y: auto;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 0.6rem;
  box-shadow: 0 12px 34px rgb(0 0 0 / 0.18);
}

.langpicker .langmenu a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.55rem;
  border-radius: 0.4rem;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
}
.langpicker .langmenu a:hover { background: var(--accent-soft); color: var(--text); }
.langpicker .langmenu a[aria-current="true"] { color: var(--text); font-weight: 600; }

/* Emoji flags: named explicitly so a text-first font cannot win and leave
 * two letters behind. Windows has no flag glyphs at all, which is survivable
 * precisely because the name is always there. */
.langpicker .flag {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.05em;
  line-height: 1;
}

/* Narrow screens: the masthead wraps, and the menu must not run off the edge.
 * The current language's name is taken off the screen rather than out of the
 * page: display:none would drop it from the accessibility tree and, with the
 * flag aria-hidden, leave the button with nothing to announce. */
@media (max-width: 30rem) {
  .langpicker .langmenu { max-height: 60vh; min-width: 11rem; }
  .langpicker .langname {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
