/* ==========================================================================
   Wisorino — foundations
   Palette, type scale, primitives and the shared motion language.
   ========================================================================== */

:root {
  /* Wood & paper ------------------------------------------------------- */
  --paper:        #FBF7F0;
  --paper-2:      #F5EDE1;
  --paper-3:      #EFE4D4;
  --card:         #FFFFFF;

  --ink:          #2B1D14;
  --ink-2:        #4A382A;
  --body:         #5E4837;
  --muted:        #8C7460;
  --faint:        #B4A08C;

  --line:         #E7DACA;
  --line-2:       #D9C8B2;

  /* Accents ------------------------------------------------------------ */
  --wood:         #A75F3E;
  --wood-deep:    #85462B;
  --wood-light:   #C98A63;
  --gold:         #B96D4D;
  --gold-soft:    #D8A184;
  --sage:         #4F7A52;
  --sage-soft:    #E4EDE2;
  --berry:        #9E3B4E;

  /* Semantics ---------------------------------------------------------- */
  --success:      #4F7A52;
  --warning:      #B4801F;
  --danger:       #A8402F;
  --info:         #3F6C86;

  /* Type --------------------------------------------------------------- */
  --font-display: 'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-sans:    'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-accent:  'Besley', 'Georgia', serif;

  --step--2: clamp(.69rem, .67rem + .1vw, .75rem);
  --step--1: clamp(.8rem, .77rem + .15vw, .875rem);
  --step-0:  clamp(.94rem, .91rem + .17vw, 1.03rem);
  --step-1:  clamp(1.13rem, 1.06rem + .33vw, 1.35rem);
  --step-2:  clamp(1.35rem, 1.22rem + .6vw, 1.8rem);
  --step-3:  clamp(1.62rem, 1.4rem + 1.05vw, 2.4rem);
  --step-4:  clamp(1.94rem, 1.58rem + 1.75vw, 3.2rem);
  --step-5:  clamp(2.33rem, 1.75rem + 2.85vw, 4.3rem);
  --step-6:  clamp(2.8rem, 1.85rem + 4.6vw, 5.9rem);

  /* Space & shape ------------------------------------------------------ */
  --gutter:     clamp(1.15rem, .8rem + 1.7vw, 2.5rem);
  --shell:      1320px;
  --shell-slim: 940px;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;
  --r-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(43, 29, 20, .05);
  --shadow-sm: 0 2px 8px rgba(43, 29, 20, .06), 0 1px 2px rgba(43, 29, 20, .04);
  --shadow-md: 0 8px 26px rgba(43, 29, 20, .09), 0 2px 6px rgba(43, 29, 20, .05);
  --shadow-lg: 0 22px 60px rgba(43, 29, 20, .13), 0 6px 18px rgba(43, 29, 20, .07);
  --shadow-glow: 0 12px 40px rgba(167, 95, 62, .28);

  /* Motion ------------------------------------------------------------- */
  --ease-out:   cubic-bezier(.22, 1, .36, 1);
  --ease-in-out:cubic-bezier(.65, 0, .35, 1);
  --ease-spring:cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: .18s;
  --t-mid:  .38s;
  --t-slow: .72s;

  --header-h: 72px;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
  overflow-x: clip;
}

body {
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--body);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  font-synthesis-weight: none;
}

/* Paper grain — a very cheap texture that stops flat areas looking digital. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: .035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
ul, ol { list-style: none; padding: 0; }

a { color: inherit; text-decoration: none; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--wood);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--wood); color: #fff; }

/* ── Type ──────────────────────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.015em;
  font-variation-settings: 'SOFT' 20, 'WONK' 1;
}

h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

.display   { font-size: var(--step-6); line-height: .98; letter-spacing: -.03em; }
.serif     { font-family: var(--font-display); }
.eyebrow {
  font-size: var(--step--2);
  letter-spacing: .22em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--wood);
}
.lede { font-size: var(--step-1); line-height: 1.55; color: var(--body); }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); }
.tiny  { font-size: var(--step--2); }

/* An ink underline that draws itself on hover. */
.link-underline {
  position: relative;
  display: inline-block;
  color: var(--ink);
}
.link-underline::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--t-mid) var(--ease-out);
}
.link-underline:hover::after { transform: scaleX(1); transform-origin: left; }

/* ── Layout ────────────────────────────────────────────────────────────── */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.shell--slim { max-width: var(--shell-slim); }

.section { padding-block: clamp(3.5rem, 2rem + 6vw, 7.5rem); }
.section--tight { padding-block: clamp(2.25rem, 1.5rem + 3vw, 4rem); }
.section--paper { background: var(--paper-2); }
.section--ink { background: var(--ink); color: var(--paper-2); }
.section--ink h1, .section--ink h2, .section--ink h3 { color: var(--paper); }

.stack > * + * { margin-top: var(--gap, 1rem); }
.center { text-align: center; }
.flow-center { margin-inline: auto; max-width: 62ch; }

.section-head { margin-bottom: clamp(2rem, 1rem + 3vw, 3.5rem); }
.section-head .eyebrow { display: block; margin-bottom: .85rem; }
.section-head h2 { margin-bottom: .7rem; }
.section-head p { max-width: 56ch; color: var(--muted); }
.section-head--center { text-align: center; }
.section-head--center p { margin-inline: auto; }

.section-head--split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.grid { display: grid; gap: clamp(1rem, .6rem + 1.6vw, 2rem); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fill, minmax(min(232px, 100%), 1fr)); }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  --btn-bg: var(--wood);
  --btn-fg: #fff;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6em;
  padding: .95em 2em;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, .24);
  backdrop-filter: blur(14px) saturate(135%);
  -webkit-backdrop-filter: blur(14px) saturate(135%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.34), inset 0 -1px 0 rgba(43,29,20,.12), 0 8px 22px rgba(43,29,20,.14);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--t-fast) var(--ease-out),
              box-shadow var(--t-mid) var(--ease-out),
              color var(--t-mid) var(--ease-out),
              background var(--t-mid) var(--ease-out),
              border-color var(--t-mid) var(--ease-out);
  white-space: nowrap;
}

/* Inline icon SVGs have no intrinsic size — constrain them to the label. */
.btn > svg { width: 1.15em; height: 1.15em; flex: none; }
.btn-text > svg { width: 1em; height: 1em; flex: none; }

/* Glass stays calm on hover: a small lift and brighter rim, no fill wipe. */
.btn::before { display: none; }
.btn:hover { transform: translateY(-2px); filter: saturate(1.06) brightness(1.03); box-shadow: inset 0 1px 0 rgba(255,255,255,.38), 0 13px 30px rgba(43,29,20,.19); }
.btn:active { transform: translateY(0) scale(.985); }

.btn--lg { padding: 1.15em 2.6em; font-size: var(--step-0); }
.btn--sm { padding: .7em 1.4em; font-size: var(--step--2); }
.btn--block { display: flex; width: 100%; }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  border-color: var(--line-2);
}
.btn--ghost:hover { color: var(--wood-deep); border-color: var(--wood); background: rgba(167,95,62,.07); }

.btn--paper {
  --btn-bg: #fff;
  --btn-fg: var(--ink);
  box-shadow: var(--shadow-sm);
}
.btn--paper:hover { color: var(--wood-deep); }

.btn--ink { --btn-bg: var(--ink); }
.btn--gold {
  --btn-bg: linear-gradient(180deg, rgba(255,255,255,.25) 0%, rgba(255,255,255,.04) 50%), linear-gradient(135deg, #BD7654, #985137);
  --btn-fg: #fff;
  border-color: rgba(255, 226, 210, .35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.38), inset 0 -1px 0 rgba(65,29,18,.18), 0 10px 26px rgba(133,70,43,.24);
}

.btn[disabled], .btn[aria-disabled='true'] {
  opacity: .5;
  pointer-events: none;
}

.btn.is-loading { color: transparent; pointer-events: none; }
.btn.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.1em; height: 1.1em;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Text link with a sliding arrow. */
.btn-text {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--ink);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line-2);
  transition: border-color var(--t-mid) var(--ease-out), gap var(--t-mid) var(--ease-out), color var(--t-mid);
}
.btn-text:hover { gap: .9em; border-color: var(--wood); color: var(--wood); }
.btn-text svg { transition: transform var(--t-mid) var(--ease-out); }

/* ── Forms ─────────────────────────────────────────────────────────────── */

.field { display: block; }
.field + .field { margin-top: 1.1rem; }

.field__label {
  display: block;
  margin-bottom: .45rem;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--ink-2);
}
.field__hint { display: block; margin-top: .4rem; font-size: var(--step--2); color: var(--muted); }
.field__req { color: var(--wood); }

.input, .textarea, .select {
  width: 100%;
  padding: .85em 1.05em;
  font-size: var(--step-0);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--wood-light); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--wood);
  box-shadow: 0 0 0 4px rgba(167, 95, 62, .12);
}
.textarea { min-height: 8.5rem; resize: vertical; line-height: 1.6; }

.select {
  appearance: none;
  padding-right: 2.6em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238C7460' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1.05em center;
}

.field.is-invalid .input,
.field.is-invalid .textarea { border-color: var(--danger); }
.field__error { margin-top: .4rem; font-size: var(--step--2); color: var(--danger); }

.checkbox { display: flex; align-items: flex-start; gap: .65rem; cursor: pointer; }
.checkbox input { margin-top: .28em; accent-color: var(--wood); width: 1.05em; height: 1.05em; flex: none; }

/* ── Chrome bits ───────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  padding: .38em .78em;
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: var(--r-pill);
  background: var(--paper-3);
  color: var(--ink-2);
  line-height: 1;
}
.badge--new  { background: var(--ink); color: var(--paper); }
.badge--sale { background: var(--berry); color: #fff; }
.badge--best { background: var(--gold); color: var(--ink); }
.badge--soft { background: var(--sage-soft); color: var(--sage); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  padding: .5em 1em;
  font-size: var(--step--2);
  font-weight: 600;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: #fff;
  color: var(--ink-2);
  transition: all var(--t-fast) var(--ease-out);
}
.pill:hover { border-color: var(--wood); color: var(--wood); }
.pill.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.stars { display: inline-flex; gap: 1px; color: var(--gold); }
.stars svg { width: 15px; height: 15px; }
.stars--muted { color: var(--line-2); }

.divider { height: 1px; background: var(--line); border: 0; }

.rule-ornament {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--line-2);
}
.rule-ornament::before, .rule-ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: currentColor;
}

/* ── Motion ────────────────────────────────────────────────────────────── */

/* Scroll reveal — JS adds .is-in when the element enters the viewport. */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .85s var(--ease-out), transform .85s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
[data-reveal='fade']  { transform: none; }
[data-reveal='left']  { transform: translateX(-34px); }
[data-reveal='right'] { transform: translateX(34px); }
[data-reveal='zoom']  { transform: scale(.94); }
[data-reveal].is-in { opacity: 1; transform: none; }

/* Words rise out of a mask, one after another. */
.reveal-lines { display: block; }
.reveal-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}
.reveal-word > span {
  display: inline-block;
  transform: translateY(105%);
  transition: transform 1s var(--ease-out);
  transition-delay: var(--word-delay, 0ms);
}
.is-in .reveal-word > span,
.reveal-lines.is-in .reveal-word > span { transform: translateY(0); }

@keyframes float-soft {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-14px) rotate(1.2deg); }
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  33%      { transform: translate(12px, -10px); }
  66%      { transform: translate(-8px, 8px); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes pulse-ring {
  0%   { transform: scale(.85); opacity: .8; }
  70%  { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes grow-line {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.float { animation: float-soft 7s var(--ease-in-out) infinite; }

.skeleton {
  background: linear-gradient(90deg, var(--paper-2) 25%, var(--paper-3) 37%, var(--paper-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-md);
}

/* ── Utilities ─────────────────────────────────────────────────────────── */

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

.skip-link {
  position: fixed;
  top: 0; left: 50%;
  transform: translate(-50%, -120%);
  z-index: 10000;
  padding: .8rem 1.4rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 0 0 var(--r-md) var(--r-md);
  font-size: var(--step--1);
  font-weight: 600;
  transition: transform var(--t-mid) var(--ease-out);
}
.skip-link:focus { transform: translate(-50%, 0); }

.no-scroll { overflow: hidden; }

.aspect-square  { aspect-ratio: 1; }
.aspect-portrait{ aspect-ratio: 4 / 5; }
.aspect-wide    { aspect-ratio: 16 / 10; }

.obj-cover { width: 100%; height: 100%; object-fit: cover; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .reveal-word > span { transform: none !important; }
}
