/* ==========================================================================
   ATELIER Hair Studio: visual foundation
   Editorial luxury. Tokens first, then base, then reusable primitives.

   Fonts are loaded in each page's <head> (see README):
     Display: Bodoni Moda (high-contrast Didone serif)
     Body:    Jost (clean geometric sans)
   ========================================================================== */


/* 1. Design tokens
   ========================================================================== */
:root {
  /* Palette (brand) */
  --color-ivory: #F5F0E8;
  --color-espresso: #3A2B25;
  --color-beige: #DCCDBB;
  --color-taupe: #B7A89A;

  /* Derived: muted text. Taupe is only 2.0:1 on ivory, so it cannot carry text.
     #62524A = 6.5:1 on ivory, 4.8:1 on beige. */
  --color-espresso-muted: #62524A;

  /* Semantic roles (re-mapped by .surface-* classes below) */
  --color-bg: var(--color-ivory);
  --color-text: var(--color-espresso);
  --color-text-muted: var(--color-espresso-muted);
  --color-line: var(--color-taupe);      /* decorative hairlines only */
  --color-focus: var(--color-espresso);

  /* Typography: families */
  --font-display: "Bodoni Moda", "Bodoni 72", Didot, Georgia, "Times New Roman", serif;
  --font-body: "Jost", Futura, "Avenir Next", "Helvetica Neue", Arial, sans-serif;

  /* Typography: fluid scale (mobile size -> desktop size) */
  --text-xs: 0.75rem;                                          /* labels */
  --text-sm: 0.875rem;
  --text-base: 1.0625rem;                                      /* body, 17px */
  --text-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);     /* lead */
  --text-xl: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);         /* h4 */
  --text-2xl: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);          /* h3 */
  --text-3xl: clamp(2.25rem, 1.6rem + 3vw, 4rem);              /* h2 */
  --text-4xl: clamp(2.75rem, 1.7rem + 5vw, 6rem);              /* h1 */
  --text-display: clamp(3.25rem, 1.5rem + 10.5vw, 11rem);      /* oversized */

  --leading-display: 0.95;
  --leading-heading: 1.12;
  --leading-body: 1.65;
  --tracking-display: -0.025em;
  --tracking-heading: -0.015em;
  --tracking-label: 0.18em;

  /* Spacing scale (4px base) */
  --space-1: 0.25rem;   /*   4 */
  --space-2: 0.5rem;    /*   8 */
  --space-3: 0.75rem;   /*  12 */
  --space-4: 1rem;      /*  16 */
  --space-5: 1.5rem;    /*  24 */
  --space-6: 2rem;      /*  32 */
  --space-7: 3rem;      /*  48 */
  --space-8: 4rem;      /*  64 */
  --space-9: 6rem;      /*  96 */
  --space-10: 8rem;     /* 128 */
  --space-section: clamp(4rem, 2.5rem + 6vw, 9rem);  /* vertical rhythm between sections */

  /* Layout */
  --container-max: 80rem;      /* 1280px */
  --container-narrow: 48rem;   /* 768px  */
  --gutter: clamp(1.25rem, 0.5rem + 3.5vw, 3rem);

  /* Borders */
  --border-width: 1px;
  --border-hairline: var(--border-width) solid var(--color-line);
  --radius: 0;                 /* editorial: square edges */

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --duration: 0.28s;
}


/* 2. Surfaces: re-map semantic colors for a section or block
   ========================================================================== */
.surface-dark {
  --color-bg: var(--color-espresso);
  --color-text: var(--color-ivory);
  --color-text-muted: var(--color-taupe);   /* 5.9:1 on espresso */
  --color-line: var(--color-taupe);
  --color-focus: var(--color-ivory);
}

.surface-beige {
  --color-bg: var(--color-beige);
  --color-text: var(--color-espresso);
  --color-text-muted: var(--color-espresso-muted);
  --color-line: var(--color-taupe);
  --color-focus: var(--color-espresso);
}

.surface-dark,
.surface-beige {
  background-color: var(--color-bg);
  color: var(--color-text);
}


/* 3. Base
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
picture,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration-thickness: var(--border-width);
  text-underline-offset: 0.2em;
}

::selection {
  background-color: var(--color-beige);
  color: var(--color-espresso);
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

hr,
.rule {
  height: 0;
  margin: 0;
  border: 0;
  border-top: var(--border-hairline);
}

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


/* 4. Typography
   ========================================================================== */
h1,
h2,
h3,
h4,
.display {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;            /* 400 left Bodoni's hairlines too thin at normal size; 500 is the heaviest weight the font request loads */
  font-optical-sizing: auto;
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-heading);
  text-wrap: balance;
  overflow-wrap: break-word;   /* safety net: a long word must never cause horizontal scroll */
}

h1 { font-size: var(--text-4xl); line-height: 1; letter-spacing: var(--tracking-display); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

.display {
  font-size: var(--text-display);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
}

p {
  margin: 0;
  text-wrap: pretty;
}

p + p {
  margin-top: var(--space-4);
}

.lead {
  font-size: var(--text-lg);
  line-height: 1.55;
}

/* Small uppercase label: nav, eyebrows, captions */
.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  line-height: 1.4;
}

.text-muted {
  color: var(--color-text-muted);
}


/* 5. Layout primitives
   ========================================================================== */
.container {
  width: min(100% - 2 * var(--gutter), var(--container-max));
  margin-inline: auto;
}

.container--narrow {
  width: min(100% - 2 * var(--gutter), var(--container-narrow));
}

.section {
  padding-block: var(--space-section);
}


/* 6. Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: 3rem;                       /* 48px touch target */
  padding: var(--space-3) var(--space-6);
  border: var(--border-width) solid var(--color-text);
  border-radius: var(--radius);
  background-color: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  white-space: normal;                    /* long labels wrap instead of spilling out when text is enlarged */
  cursor: pointer;
  transition:
    background-color var(--duration) var(--ease),
    color var(--duration) var(--ease),
    border-color var(--duration) var(--ease);
}

.btn:hover {
  background-color: var(--color-text);
  color: var(--color-bg);
}

/* Primary: solid, inverts on hover */
.btn--primary {
  background-color: var(--color-text);
  color: var(--color-bg);
}

.btn--primary:hover {
  background-color: transparent;
  color: var(--color-text);
}

/* Text: quiet link-style action with a hairline underline */
.btn--text {
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  border-bottom: var(--border-width) solid currentColor;
  background-color: transparent;
}

.btn--text:hover {
  background-color: transparent;
  color: var(--color-text-muted);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}


/* 7. Motion preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
