@layer reset, base, layout, components, responsive;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, p, figure { margin: 0; }
  button, input { font: inherit; }
  button, a, label { -webkit-tap-highlight-color: transparent; }
  button { cursor: pointer; }
  img { display: block; max-width: 100%; }
  [hidden] { display: none !important; }
}
@layer base {
  :root { --paper: #f6f5ef; --ink: #203b36; --forest: #173f3a; --muted: #657069; --line: #d6dbd0; --lime: #d4e69f; --selected: #eaf0df; --radius: 12px; }
  body { background: var(--paper); color: var(--ink); font: 15px/1.5 "Avenir Next", Avenir, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
  ::selection { background: var(--lime); color: var(--forest); }
  :focus-visible { outline: 3px solid #50806a; outline-offset: 5px; }
  a { color: inherit; }
  button { color: inherit; }
  .skip-link { position: fixed; top: 12px; left: 12px; z-index: 5; transform: translateY(-180%); padding: 12px 20px; background: var(--forest); color: white; }
  .skip-link:focus { transform: none; }
}
@layer layout {
  .page-shell { width: min(100% - 112px, 1280px); margin-inline: auto; }
  .site-header { height: 108px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
  main { min-height: calc(100svh - 185px); }
  .welcome { display: grid; grid-template-columns: 1.12fr 1fr; gap: clamp(40px, 6vw, 100px); align-items: center; padding: 56px 0 54px; }
  .intro { max-width: 610px; }
  .site-footer { flex-wrap: wrap; padding-block: 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 77px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; letter-spacing: .02em; }
  .site-footer > :last-child { display: flex; align-items: center; gap: 17px; }
  .site-footer svg { width: 18px; height: 18px; stroke: var(--forest); stroke-width: 1.5; }
}
@layer components {
  .wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; font-size: 34px; letter-spacing: -2px; line-height: 1; }
  .brand-dot { color: #739556; }
  .header-note { font-size: 13px; color: var(--muted); margin-right: 42px; }
  .language-note { display: flex; gap: 9px; align-items: center; font-size: 12px; font-weight: 500; }
  .language-note > span { font-size: 20px; }
  .eyebrow { display: flex; align-items: center; gap: 9px; font-size: 10px; font-weight: 650; letter-spacing: .15em; }
  .small-spark { font-size: 20px; line-height: 1; color: #577044; }
  h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(50px, 5.1vw, 74px); font-weight: 400; letter-spacing: -.047em; line-height: 1.04; margin-top: 24px; }
  h1 em { color: #597345; font-weight: 400; }
  .hero-description { max-width: 410px; font-size: 15px; line-height: 1.8; color: var(--muted); margin-top: 24px; }
  .modes { border: 0; margin: 30px 0 0; padding: 0; min-width: 0; }
  .modes legend { padding: 0; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
  .mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .mode-option { position: relative; cursor: pointer; }
  .mode-option input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
  .mode-card { display: block; min-height: 156px; padding: 17px 18px 16px; border: 1px solid #c7cfc3; border-radius: var(--radius); transition: background 160ms, border-color 160ms; }
  .mode-option:hover .mode-card { border-color: #72916c; background: #eff1e8; }
  .mode-option input:checked + .mode-card { background: var(--selected); border-color: #6c8958; }
  .mode-option input:focus-visible + .mode-card { outline: 3px solid #50806a; outline-offset: 4px; }
  .mode-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
  .mode-icon { width: 23px; height: 23px; stroke: var(--forest); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .selection-dot { width: 17px; height: 17px; border: 1px solid #78846f; border-radius: 50%; display: grid; place-items: center; }
  input:checked + .mode-card .selection-dot { background: var(--forest); border-color: var(--forest); }
  input:checked + .mode-card .selection-dot::after { content: ""; display: block; width: 7px; height: 4px; border-left: 1.5px solid white; border-bottom: 1.5px solid white; transform: translateY(-1px) rotate(-45deg); }
  .mode-name { display: block; font-size: 15px; font-weight: 600; margin-bottom: 5px; }
  .mode-description { display: block; font-size: 11px; line-height: 1.6; color: #59675b; }
  .continue-row { display: flex; align-items: center; gap: 21px; margin-top: 23px; }
  .next-button { display: flex; align-items: center; justify-content: space-between; gap: 55px; min-height: 52px; padding: 0 22px; border: 1px solid var(--forest); border-radius: 7px; background: var(--forest); color: white; font-size: 13px; font-weight: 600; transition: background 150ms; }
  .next-button:hover { background: #2a5548; }
  .next-button svg { width: 21px; height: 21px; stroke: var(--lime); stroke-width: 1.5; }
  .continue-note { max-width: 170px; font-size: 11px; color: var(--muted); line-height: 1.6; }
  .avatar-feature { align-self: center; width: 100%; max-width: 505px; justify-self: end; }
  .portrait-frame { position: relative; overflow: hidden; border-radius: 160px 160px 16px 16px; background: #1d2521; aspect-ratio: 480/606; }
  .avatar-portrait { width: 100%; height: 100%; object-fit: cover; object-position: center 39%; }
  .portrait-label { position: absolute; top: 29px; left: 0; right: 0; text-align: center; color: #e5e9d9; font-size: 8px; font-weight: 500; letter-spacing: .13em; text-shadow: 0 1px 8px #000; }
  .portrait-label > span { margin-right: 6px; color: var(--lime); font-size: 13px; }
  .portrait-caption { position: absolute; bottom: 0; left: 0; right: 0; padding: 65px 28px 27px; background: linear-gradient(transparent, rgb(8 21 22 / .85)); color: white; }
  .hello { display: block; font: italic 28px/1.3 Georgia, serif; letter-spacing: -.03em; }
  .caption-detail { display: block; margin-top: 6px; font-size: 11px; color: #dbe4df; }
  .avatar-signature { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 18px 1px 0; }
  .avatar-signature > div { display: flex; align-items: baseline; gap: 12px; }
  .avatar-name { font: 26px Georgia, serif; letter-spacing: -.04em; }
  .pronunciation { font-size: 10px; color: var(--muted); }
  .signature-note { font-size: 10px; color: var(--muted); max-width: 100px; text-align: right; line-height: 1.5; }
  .next-step { padding: 38px 0 64px; }
  .back-button { padding: 10px 0; border: 0; background: transparent; display: flex; gap: 10px; align-items: center; font-size: 13px; }
  .back-button:hover { text-decoration: underline; }
  .next-layout { display: grid; grid-template-columns: minmax(200px, 330px) 1fr; gap: 70px; align-items: center; max-width: 930px; margin: 45px auto; }
  .next-portrait { border-radius: 140px 140px 12px 12px; }
  .next-description { margin-top: 28px; font-size: 17px; }
  .preview-message { color: var(--muted); max-width: 320px; margin-top: 12px; }
  .preview-label { display: inline-block; margin-top: 25px; font-size: 9px; letter-spacing: .12em; padding-top: 16px; border-top: 1px solid var(--line); }
}
@layer responsive {
  @media (min-width: 1500px) { .welcome { padding-block: 70px; } }
  @media (max-width: 1100px) {
    .page-shell { width: calc(100% - 72px); }
    .welcome { gap: 42px; padding-block: 42px; grid-template-columns: 1.12fr 1fr; }
    h1 { font-size: 58px; }
    .portrait-frame { border-top-left-radius: 130px; border-top-right-radius: 130px; aspect-ratio: 400/570; }
    .mode-card { padding-inline: 14px; }
    .signature-note { display: none; }
  }
  @media (max-width: 850px) {
    .page-shell { width: calc(100% - 48px); }
    .site-header { height: 86px; }
    .header-note { display: none; }
    .welcome { gap: 26px; }
    h1 { font-size: 49px; }
    .hero-description { font-size: 13px; margin-top: 20px; }
    .mode-card { min-height: 158px; padding: 14px 11px; }
    .mode-description { font-size: 10px; }
    .modes { margin-top: 25px; }
    .continue-row { gap: 15px; }
    .next-button { gap: 35px; }
    .portrait-label { font-size: 7px; top: 23px; }
    .portrait-frame { aspect-ratio: 320/590; border-top-left-radius: 110px; border-top-right-radius: 110px; }
    .hello { font-size: 24px; }
    .portrait-caption { padding-inline: 20px; }
    .next-layout { gap: 35px; }
  }
  @media (max-width: 620px) {
    .page-shell { width: calc(100% - 40px); }
    .site-header { height: 78px; }
    .wordmark { font-size: 30px; }
    .wordmark img { width: 29px; height: 29px; }
    .language-note { font-size: 10px; gap: 6px; }
    .language-note > span { font-size: 17px; }
    .welcome { display: flex; flex-direction: column; gap: 27px; padding: 30px 0 34px; }
    .intro { display: contents; }
    .eyebrow { font-size: 8px; gap: 7px; align-self: flex-start; }
    .small-spark { font-size: 16px; }
    h1 { align-self: flex-start; font-size: clamp(46px, 12vw, 64px); margin-top: -11px; }
    .hero-description { align-self: flex-start; max-width: 350px; margin-top: -13px; font-size: 13px; line-height: 1.75; }
    .avatar-feature { order: 1; max-width: none; width: 100%; }
    .portrait-frame { aspect-ratio: 350/365; border-radius: 100px 100px 12px 12px; }
    .avatar-portrait { object-position: center 27%; }
    .portrait-label { top: 22px; font-size: 7px; }
    .portrait-caption { padding: 50px 22px 20px; }
    .hello { font-size: 25px; }
    .avatar-signature { padding-top: 12px; }
    .avatar-name { font-size: 24px; }
    .signature-note { display: block; font-size: 9px; max-width: 90px; }
    #mode-form { order: 2; width: 100%; }
    .modes { margin-top: 0; }
    .modes legend { font-size: 13px; margin-bottom: 12px; }
    .mode-card { min-height: 150px; padding: 15px 13px; }
    .mode-description { font-size: 10px; }
    .continue-row { margin-top: 17px; flex-direction: column; gap: 10px; }
    .next-button { width: 100%; min-height: 53px; font-size: 14px; }
    .continue-note { max-width: none; font-size: 10px; }
    .site-footer { min-height: 78px; gap: 15px; font-size: 9px; }
    .site-footer > :last-child { gap: 7px; }
    .site-footer svg { width: 14px; }
    .next-layout { display: flex; flex-direction: column; align-items: flex-start; gap: 30px; margin-top: 20px; }
    .next-portrait { width: 170px; height: 195px; object-fit: cover; object-position: center 23%; border-radius: 70px 70px 8px 8px; }
    .next-layout h1 { margin-top: 15px; }
    .next-description { font-size: 16px; }
  }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
}
