/* Cascade layers, reset, design tokens, base type and page layout.
   Load order (see index.html): fonts, base, components, views, utilities, refinements. */

@layer reset, tokens, base, layout, components, views, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body, h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset { margin: 0; padding: 0; }
  ul, ol { list-style: none; }
  fieldset { border: 0; min-width: 0; }
  img, svg { display: block; max-width: 100%; }
  button, input, select { font: inherit; color: inherit; }
  button { cursor: pointer; }
  button:disabled { cursor: not-allowed; }
  /* No double-tap zoom on controls (it fought with quick double taps), and no grey flash on tap. */
  a, button, summary, label, select, input { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
}

@layer tokens {
  /* Tokens. Spacing steps in rem (4 px grid at the default size): 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 2.5, 3, 4.
     Type scale: 0.8125 (meta), 0.875, 0.9375, 1 (body), 1.0625, 1.25, 1.75 (dialog titles), then fluid display sizes.
     Radius: 0 everywhere (square brand), except round icon buttons, badges, pills and the switch.
     Shadow: --float for things that float above the page; nothing else casts a shadow except the card button.
     Motion: 300 ms or less, eased with --ease; prefers-reduced-motion turns it off. */
  :root {
    --ink: #16161D;
    --ink-2: #55555F;
    --chalk: #F6F5F1;
    --paper: #FFFFFF;
    --line: rgb(22 22 29 / 0.14);
    --line-strong: rgb(22 22 29 / 0.42);
    --aubergine: #3B2A4A;
    --sky: #C9D8E6;
    --saffron: #E8B23A;
    --forest: #1F4D3A;
    --sale: #B3261E;
    --ok: #1F6B47;
    --ok-wash: #E8F2EC;
    /* Each room tints its product photos, so a product always "belongs" to its room. */
    --tint-wardrobe: #EEEAF3;
    --tint-desk: #E9EFF5;
    --tint-living-room: #F8F1E1;
    --tint-pet-corner: #E6EEE9;
    --float: 0 0 0 1px rgb(22 22 29 / 0.08), 0 1.25rem 3rem rgb(22 22 29 / 0.2);
    --display: "ok-display", Georgia, "Times New Roman", serif;
    --sans: "ok-sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --gutter: 1rem;
    --page: 90rem;
    --tap: 2.75rem;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --header-h: 4rem;
    color-scheme: light;
  }
  /* Greek: the brand fonts have no Greek letters, so Greek pages use the device's own fonts throughout (never mixed letters). */
  html:lang(el) { --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif; --display: Georgia, "Noto Serif", "Times New Roman", serif; }
  /* Japanese: Latin letters keep the brand fonts, Japanese characters use the device's Japanese fonts (no megabyte downloads). */
  html:lang(ja) { --sans: "ok-sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", "Noto Sans CJK JP", sans-serif; --display: "ok-display", "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "Noto Serif JP", "Noto Serif CJK JP", serif; }
  /* Root size grows on large and TV screens; set in percent so the visitor's own font setting still applies. */
  @media (min-width: 120rem) { html { font-size: 112.5%; } }
  @media (min-width: 160rem) { html { font-size: 125%; } :root { --page: 110rem; } }
  @media (min-width: 200rem) { html { font-size: 150%; } }
}

@layer base {
  body { background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 1rem; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
  html:has(dialog[open]) { overflow: hidden; }
  :focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
  .on-dark :focus-visible, .on-dark:focus-visible { outline-color: #fff; }
  a { color: inherit; text-underline-offset: 0.2em; }
  .display { font-family: var(--display); font-weight: 400; letter-spacing: -0.012em; line-height: 1.02; }
  .num { font-variant-numeric: tabular-nums lining-nums; }
  html:lang(ja) body { line-height: 1.75; }
  :is(.hero__title, .section__title, .band__title, .promise__title, .room__name, .empty__title, .pd__title) { text-wrap: balance; }
  :is(.hero__title, .section__title, .band__title, .promise__title, .empty__title, .sheet__title, .co-h) { overflow-wrap: anywhere; hyphens: auto; }
  html:lang(ja) :is(.display, .sheet__title, .pd__title, .card__title) { letter-spacing: 0; line-height: 1.3; word-break: auto-phrase; line-break: strict; }
  ::selection { background: var(--saffron); color: var(--ink); }
}

@layer layout {
  .wrap { width: 100%; max-width: var(--page); margin-inline: auto; padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
  @media (min-width: 45rem) { :root { --gutter: 2rem; } }
  @media (min-width: 64rem) { :root { --gutter: 3rem; --header-h: 5rem; } }
}
