@layer reset, tokens, base, layout, components, blocks, utilities, responsive;

@layer tokens {
  :root {
    color-scheme: light;
    --color-primary: #8b4b2f;
    --color-primary-hover: #713a25;
    --color-primary-active: #5d2f1e;
    --color-primary-contrast: #fff;
    --color-secondary: #baa08c;
    --color-accent: #b86f49;
    --color-background: #fcfaf7;
    --color-background-warm: #f7f1eb;
    --color-surface: #fff;
    --color-surface-muted: #f3ece5;
    --color-text: #292522;
    --color-text-soft: #625a54;
    --color-text-subtle: #756c66;
    --color-border: #d8ccc2;
    --color-border-strong: #a99b90;
    --color-focus: #275e68;
    --color-error: #9d2f2f;
    --color-error-soft: #faeaea;
    --color-success: #276749;
    --color-success-soft: #e8f3ed;
    --color-warning: #8a5a11;
    --color-warning-soft: #fbf1d8;
    --color-info: #275e68;
    --color-info-soft: #e8f1f3;
    --overlay-soft: rgb(32 25 21 / 0.18);
    --overlay-strong: rgb(32 25 21 / 0.62);
    --font-display: Georgia, "Times New Roman", serif;
    --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-size-body: 18px;
    --font-size-lead: clamp(20px, 1.6vw, 22px);
    --font-size-small: 16px;
    --font-size-caption: 15px;
    --font-size-button: 15px;
    --font-size-navigation: 14px;
    --line-height-body: 1.65;
    --line-height-heading: 1.04;
    --text-display-l: clamp(3rem, 5.4vw, 5.5rem);
    --text-display-m: clamp(2.5rem, 4.2vw, 4.25rem);
    --text-h1: clamp(2.5rem, 4.4vw, 4.75rem);
    --text-h2: clamp(2rem, 3.3vw, 3.25rem);
    --text-h3: clamp(1.625rem, 2.3vw, 2.25rem);
    --text-h4: clamp(1.3rem, 1.8vw, 1.625rem);
    --text-h5: 1.125rem;
    --text-body-xl: var(--font-size-lead);
    --text-small: var(--font-size-small);
    --text-caption: var(--font-size-caption);
    --text-button: var(--font-size-button);
    --space-2xs: 0.25rem;
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;
    --space-5xl: 8rem;
    --section-space: clamp(4rem, 9vw, 8rem);
    --layout-gutter: clamp(1rem, 4vw, 3.5rem);
    --layout-safe-start: calc(var(--layout-gutter) + env(safe-area-inset-left, 0px));
    --layout-safe-end: calc(var(--layout-gutter) + env(safe-area-inset-right, 0px));
    --layout-content-width: 50.625rem;
    --layout-standard-width: 84.375rem;
    --layout-wide-width: 101.25rem;
    --layout-full-width: 100%;
    --page-gutter: var(--layout-gutter);
    --container-copy: var(--layout-content-width);
    --container-standard: var(--layout-standard-width);
    --container-wide: var(--layout-wide-width);
    --grid-gap: clamp(1rem, 2.2vw, 2rem);
    --duration-fast: 180ms;
    --duration-base: 280ms;
    --duration-slow: 520ms;
    --ease-standard: cubic-bezier(0.2, 0, 0, 1);
    --ease-emphasized: cubic-bezier(0.16, 1, 0.3, 1);
    --kp-z-content: 0;
    --kp-z-elevated: 10;
    --kp-z-sticky: 20;
    --kp-z-header: 200;
    --kp-z-mobile-nav: 210;
    --kp-z-modal: 1000;
    --kp-z-a11y: 1100;
    --z-content: var(--kp-z-content);
    --z-elevated: var(--kp-z-elevated);
    --z-sticky: var(--kp-z-sticky);
    --z-header: var(--kp-z-header);
    --z-navigation: var(--kp-z-mobile-nav);
    --z-modal: var(--kp-z-modal);
    --z-a11y: var(--kp-z-a11y);
    --z-overlay: var(--kp-z-mobile-nav);
  }
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; scroll-padding-top: 6rem; }
  body { margin: 0; }
  :where(.custom-logo, .wp-post-image),
  :where(.wp-block-image, .wp-block-gallery, .wp-block-cover, .wp-block-media-text, .wp-block-video, .wp-block-embed) :where(img, svg, iframe, video, embed, object),
  :where(.home-hero__media, .session-card__media, .home-about, .kp-editorial-gallery, .bts-grid__media, .journal-card__media, .social-strip, .booking-cta) img { display: block; max-width: 100%; }
  button, input, textarea, select { font: inherit; }
  button { cursor: pointer; }
}

@layer base {
  body { background: var(--color-background); color: var(--color-text); font-family: var(--font-body); font-size: var(--font-size-body); font-weight: 400; line-height: var(--line-height-body); text-rendering: optimizeLegibility; }
  h1, h2, h3, h4, h5, p, blockquote { margin-top: 0; }
  h1, h2, h3, h4, h5 { color: var(--color-text); font-family: var(--font-display); font-weight: 400; letter-spacing: -0.025em; line-height: var(--line-height-heading); }
  h1 { font-size: var(--text-h1); }
  h2 { font-size: var(--text-h2); }
  h3 { font-size: var(--text-h3); }
  h4 { font-size: var(--text-h4); }
  h5 { font-size: var(--text-h5); }
  :where(.entry-content, .wp-block-post-content) :where(p, li, dd, figcaption, blockquote, h1, h2, h3, h4, h5, h6) a,
  :where(.entry-content, .wp-block-post-content) :where(.wp-block-file, .wp-block-latest-posts, .wp-block-categories, .wp-block-archives, .wp-block-page-list, .wp-block-query-pagination, .wp-block-post-title, .wp-block-post-excerpt) a,
  :where(.entry-content, .wp-block-post-content) :where(.wp-block-read-more, .wp-block-post-excerpt__more-link),
  .kp-content-link { color: var(--color-primary); text-decoration-thickness: 0.08em; text-underline-offset: 0.22em; }
  :where(.entry-content, .wp-block-post-content) :where(p, li, dd, figcaption, blockquote, h1, h2, h3, h4, h5, h6) a:hover,
  :where(.entry-content, .wp-block-post-content) :where(.wp-block-file, .wp-block-latest-posts, .wp-block-categories, .wp-block-archives, .wp-block-page-list, .wp-block-query-pagination, .wp-block-post-title, .wp-block-post-excerpt) a:hover,
  :where(.entry-content, .wp-block-post-content) :where(.wp-block-read-more, .wp-block-post-excerpt__more-link):hover,
  .kp-content-link:hover { color: var(--color-primary-hover); }
  :focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }
  ::selection { background: var(--color-secondary); color: var(--color-text); }
  :where(.entry-content, .wp-block-post-content) :where(p, li, dd, figcaption), .site-footer a { overflow-wrap: anywhere; }
  :where(.entry-content, .wp-block-post-content) :where(h1, h2, h3, h4, h5, h6), [data-kp-scroll-target] { scroll-margin-top: 7rem; }
}

@layer layout {
  .container { width: min(calc(100% - (2 * var(--layout-gutter))), var(--layout-standard-width)); margin-inline: auto; padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .container--copy, .container--narrow { width: min(calc(100% - (2 * var(--layout-gutter))), var(--layout-content-width)); margin-inline: auto; padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .container--wide { width: min(calc(100% - (2 * var(--layout-gutter))), var(--layout-wide-width)); margin-inline: auto; padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .section { padding-block: var(--section-space); }
  .section--full { width: var(--layout-full-width); max-width: none; }
  .section--warm { background: var(--color-background-warm); }
  .section--dark { background: var(--color-text); color: var(--color-background); }
  .section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: var(--color-background); }
  :where(.entry-content, .wp-block-post-content) > :where(:not(.alignwide):not(.alignfull)) { width: 100%; max-width: var(--layout-content-width); margin-inline: auto; }
  :where(.entry-content, .wp-block-post-content) > .alignwide { width: 100%; max-width: var(--layout-wide-width); margin-inline: auto; }
  :where(.entry-content, .wp-block-post-content) > .alignfull { width: auto; max-width: none; margin-left: calc(-1 * var(--layout-safe-start)); margin-right: calc(-1 * var(--layout-safe-end)); }
  .page-layout { width: 100%; max-width: none; }
  .page-layout--default .entry-content > :where(.wp-block-gallery, figure, table) { max-width: var(--layout-content-width); }
  .page-layout--full .entry-content > :where(.wp-block-group, .wp-block-columns, .wp-block-cover, .wp-block-media-text) { max-width: var(--layout-standard-width); }
  .page-layout--full .entry-content > :where(.wp-block-gallery, .wp-block-image, figure, table) { max-width: var(--layout-wide-width); }
  :where(.page-layout--full, .page-layout--full-content) .entry-content > .bwg_container { max-width: var(--layout-wide-width); }
  .entry-content--full-content > :where(:not(.alignfull)) { max-width: var(--layout-wide-width); }
  .entry-content--full-content > :where(p, h1, h2, h3, h4, h5, h6, ul, ol, dl, blockquote, pre, address) { max-width: var(--layout-content-width); }
  .page-layout--full-content .entry-content > :where(:not(.alignfull)) { max-width: var(--layout-wide-width); }
  .page-layout--full-content .entry-content > :where(p, h1, h2, h3, h4, h5, h6, ul, ol, dl, blockquote, pre, address) { max-width: var(--layout-content-width); }
}

@layer utilities {
  .screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .skip-link { color: var(--color-text); }
  .screen-reader-text:focus { position: fixed !important; z-index: var(--z-a11y); top: calc(0.75rem + env(safe-area-inset-top, 0px)); left: var(--layout-safe-start); width: auto; height: auto; padding: 0.75rem 1rem; clip: auto; background: var(--color-surface); color: var(--color-text); font-weight: 700; }
  .todo-owner { padding: 0.2rem 0.45rem; background: var(--color-warning-soft); color: var(--color-warning); font-size: var(--text-caption); letter-spacing: 0.04em; }
  .kp-reveal { opacity: 1; transform: none; }
  .kp-reveal.is-pending { opacity: 0; transform: translateY(var(--space-lg)); transition: opacity 620ms var(--ease-standard), transform 620ms var(--ease-emphasized); }
  .kp-reveal.is-pending.is-visible { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  :where(.kp-site-header, .kp-site-nav, .kp-site-nav .sub-menu, .kp-site-nav a::after, .kp-menu-toggle__lines span, .button, .wp-block-button__link, .session-card img, .faq-list summary::after, .kp-reveal) { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .kp-reveal.is-pending { opacity: 1; transform: none; }
}

@media (forced-colors: active) {
  :focus-visible { outline: 3px solid Highlight; }
}
