
@layer tokens, base, layout, parts;

@layer tokens {
  :root {
    color-scheme: light dark;
    --canvas: #fbf5ee;
    --ink: #2a1d18;
    --ink-muted: #6b5950;
    --rule: rgb(42 29 24 / 0.14);
    --accent-ink: #b8264e;
    --panel-from: #d92e5b;
    --panel-to: #b8264e;
    --panel-glow: rgb(255 255 255 / 0.16);
    --rounded: ui-rounded, 'SF Pro Rounded', 'Nunito', 'Varela Round', system-ui, -apple-system,
      'Segoe UI', Roboto, sans-serif;
    --text: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --measure: 1080px;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --canvas: #14100e;
      --ink: #f7efe9;
      --ink-muted: #c2b2a9;
      --rule: rgb(247 239 233 / 0.16);
      --accent-ink: #ff5c80;
      --panel-from: #a3203f;
      --panel-to: #3a0d1a;
      --panel-glow: rgb(255 255 255 / 0.12);
    }
  }
  @media (prefers-contrast: more) {
    :root {
      --rule: var(--ink-muted);
    }
  }
}

@layer base {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: 400 1.0625rem/1.6 var(--text);
    -webkit-font-smoothing: antialiased;
  }
  h1,
  h2 {
    font-family: var(--rounded);
    font-weight: 700;
    text-wrap: balance;
    margin: 0;
  }
  p {
    margin: 0;
    text-wrap: pretty;
  }
  a {
    color: inherit;
    text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
  }
  a:hover {
    text-decoration-color: currentColor;
  }
  :focus-visible {
    outline: 2px solid var(--accent-ink);
    outline-offset: 4px;
    border-radius: 4px;
  }
  .panel :focus-visible {
    outline-color: #fff;
  }
}

@layer layout {
  .page {
    width: min(100% - 2 * max(20px, env(safe-area-inset-left)), var(--measure));
    margin-inline: auto;
  }
}

@layer parts {
  .skip {
    position: absolute;
    left: 12px;
    top: -60px;
    padding: 8px 14px;
    background: var(--ink);
    color: var(--canvas);
    border-radius: 8px;
    font-weight: 600;
  }
  .skip:focus {
    top: 12px;
  }

  .top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 28px;
    padding-block: max(22px, env(safe-area-inset-top)) 22px;
    border-bottom: 1px solid var(--rule);
  }
  .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font: 700 1.25rem/1 var(--rounded);
    letter-spacing: -0.01em;
    text-decoration: none;
  }
  .brand svg {
    width: 30px;
    height: 30px;
    flex: none;
  }
  .top nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 24px;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .top nav a {
    font: 600 0.9375rem/1.4 var(--rounded);
    color: var(--ink-muted);
    text-decoration: none;
    padding-block: 10px;
  }
  .top nav a:hover {
    color: var(--ink);
    text-decoration: underline;
  }

  .statement {
    padding-block: clamp(48px, 10vw, 120px) clamp(40px, 7vw, 80px);
    display: grid;
    gap: 22px;
  }
  .statement h1 {
    max-width: 15ch;
    font-size: clamp(2.35rem, 1.2rem + 5vw, 4.75rem);
    line-height: 1.02;
    letter-spacing: -0.035em;
  }
  .statement h1 em {
    font-style: normal;
    color: var(--accent-ink);
  }
  .statement p {
    max-width: 44ch;
    color: var(--ink-muted);
    font-size: 1.125rem;
  }

  /* Gido's world: the coral gradient and its Welcome illustration (DESIGN.md §6.1). */
  .panel {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    gap: 8px 40px;
    align-items: center;
    padding: clamp(28px, 5vw, 56px);
    border-radius: 28px;
    color: #fff;
    background: linear-gradient(160deg, var(--panel-from) 30%, var(--panel-to));
  }
  @media (min-width: 820px) {
    .panel {
      grid-template-columns: 1fr minmax(260px, 380px);
    }
  }
  .panel::after {
    content: '';
    position: absolute;
    inset: -25% -20% auto auto;
    width: 55%;
    aspect-ratio: 1;
    z-index: -1;
    background: radial-gradient(closest-side, var(--panel-glow), transparent);
  }
  .panel h2 {
    font-size: clamp(2.25rem, 1.5rem + 3vw, 3.5rem);
    line-height: 1;
    letter-spacing: -0.03em;
    margin-bottom: 14px;
  }
  .panel .say {
    font: 600 clamp(1.2rem, 1rem + 0.8vw, 1.45rem) / 1.35 var(--rounded);
    max-width: 24ch;
  }
  .panel .note {
    margin-top: 14px;
    max-width: 46ch;
  }
  .panel ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0 22px;
    list-style: none;
    margin: 22px 0 0;
    padding: 0;
    font: 600 0.9375rem/1.4 var(--rounded);
  }
  .panel ul a {
    display: inline-block;
    padding-block: 11px;
    color: #fff;
    text-decoration-color: rgb(255 255 255 / 0.6);
  }
  .panel img {
    width: 100%;
    max-width: 380px;
    height: auto;
    justify-self: center;
  }

  .details {
    padding-block: clamp(56px, 9vw, 104px) 24px;
    display: grid;
    gap: 24px;
  }
  @media (min-width: 820px) {
    .details {
      grid-template-columns: 14rem 1fr;
      gap: 40px;
    }
  }
  .details h2 {
    font-size: 1.375rem;
    line-height: 1.3;
  }
  .details dl {
    margin: 0;
  }
  .details dl div {
    display: grid;
    gap: 2px 32px;
    padding-block: 16px;
    border-top: 1px solid var(--rule);
  }
  .details dl div:last-child {
    border-bottom: 1px solid var(--rule);
  }
  @media (min-width: 560px) {
    .details dl div {
      grid-template-columns: 11rem 1fr;
    }
  }
  .details dt {
    color: var(--ink-muted);
    font-size: 0.9375rem;
  }
  .details dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
  }
  .details address {
    font-style: normal;
  }
  .details a {
    color: var(--accent-ink);
  }

  .bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 24px;
    padding-block: 40px max(40px, env(safe-area-inset-bottom));
    color: var(--ink-muted);
    font-size: 0.875rem;
  }

  .lost {
    padding-block: clamp(64px, 14vw, 160px);
    display: grid;
    gap: 16px;
  }
  .lost h1 {
    font-size: clamp(2rem, 1.4rem + 3vw, 3rem);
    letter-spacing: -0.03em;
  }
  .lost a {
    color: var(--accent-ink);
  }
}
