@layer reset, base, primitives;

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

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

  body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol, li, pre, code, fieldset, legend, button, input, select, textarea {
    margin: 0;
    padding: 0;
  }

  ul, ol {
    list-style: none;
  }

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

  input, button, textarea, select {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    border-radius: 0;
    outline: none;
  }

  button {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
  }

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

  table {
    border-collapse: collapse;
    border-spacing: 0;
  }

  blockquote, q {
    quotes: none;
  }

  blockquote::before, blockquote::after, q::before, q::after {
    content: '';
    content: none;
  }

  [hidden] {
    display: none !important;
  }
}

@layer base {
  :root {
    --color-ivory: #F7F4EE;
    --color-bottle-green: #1F4D3A;
    --color-soft-lavender: #E6E0F0;
    --color-warm-peach: #F2B79A;
    --color-light-stone: #EDE9E1;
    --color-dark-graphite: #2A2A28;
    --color-deep-bottle-green: #123326;
    --color-graphite: #1E1E1C;
    --color-ivory-poker: #F7F4EE;
    --color-lavender-accent: #C9BEDD;

    --font-heading: 'Fraunces', serif;
    --font-body: 'Inter', sans-serif;

    --text-display-size: clamp(2.5rem, 5vw + 1rem, 4rem);
    --text-display-line-height: 1.05;
    --text-display-weight: 600;
    --text-display-tracking: -0.02em;

    --text-h1-size: clamp(2rem, 3.5vw + 0.75rem, 3rem);
    --text-h1-line-height: 1.1;
    --text-h1-weight: 600;

    --text-h2-size: clamp(1.75rem, 2.5vw + 0.6rem, 2.25rem);
    --text-h2-line-height: 1.15;
    --text-h2-weight: 550;

    --text-h3-size: clamp(1.5rem, 1.8vw + 0.5rem, 1.75rem);
    --text-h3-line-height: 1.2;
    --text-h3-weight: 500;

    --text-h4-size: clamp(1.25rem, 1.2vw + 0.4rem, 1.375rem);
    --text-h4-line-height: 1.3;
    --text-h4-weight: 500;

    --text-body-large-size: 1.125rem;
    --text-body-large-line-height: 1.6;
    --text-body-large-weight: 400;

    --text-body-size: 1rem;
    --text-body-line-height: 1.6;
    --text-body-weight: 400;

    --text-caption-size: 0.875rem;
    --text-caption-line-height: 1.4;
    --text-caption-weight: 400;
    --text-caption-tracking: 0.01em;

    --text-overline-size: 0.75rem;
    --text-overline-line-height: 1.2;
    --text-overline-weight: 600;
    --text-overline-tracking: 0.12em;

    --space-2: 2px;
    --space-4: 4px;
    --space-8: 8px;
    --space-12: 12px;
    --space-16: 16px;
    --space-24: 24px;
    --space-32: 32px;
    --space-48: 48px;
    --space-64: 64px;
    --space-96: 96px;
    --space-128: 128px;

    --container-max: 1200px;
    --container-padding-mobile: 24px;
    --container-padding-desktop: 48px;

    --radius-card: 16px;
    --radius-button: 8px;
    --radius-field: 8px;
    --radius-image: 12px;
    --radius-modal: 24px;
    --radius-tag: 4px;

    --shadow-card: 0 8px 24px rgba(42, 42, 40, 0.06);

    --border-bottle: 1px solid var(--color-bottle-green);
    --border-dark: 1px solid var(--color-dark-graphite);
    --border-lavender: 1px solid var(--color-lavender-accent);
    --border-ivory-20: 1px solid rgba(247, 244, 238, 0.2);

    --transition-fast: 200ms ease-out;

    --focus-ring: 2px solid var(--color-warm-peach);
    --focus-offset: 2px;
  }

  html {
    font-family: var(--font-body);
    font-size: var(--text-body-size);
    line-height: var(--text-body-line-height);
    font-weight: var(--text-body-weight);
    color: var(--color-dark-graphite);
    background-color: var(--color-ivory);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--color-ivory);
    color: var(--color-dark-graphite);
    overflow-x: hidden;
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-dark-graphite);
    text-wrap: balance;
  }

  h1 {
    font-size: var(--text-h1-size);
    line-height: var(--text-h1-line-height);
    font-weight: var(--text-h1-weight);
    margin-block-end: var(--space-24);
  }

  h2 {
    font-size: var(--text-h2-size);
    line-height: var(--text-h2-line-height);
    font-weight: var(--text-h2-weight);
    margin-block-end: var(--space-16);
  }

  h3 {
    font-size: var(--text-h3-size);
    line-height: var(--text-h3-line-height);
    font-weight: var(--text-h3-weight);
    margin-block-end: var(--space-12);
  }

  h4 {
    font-size: var(--text-h4-size);
    line-height: var(--text-h4-line-height);
    font-weight: var(--text-h4-weight);
    margin-block-end: var(--space-8);
  }

  h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-dark-graphite);
  }

  h5 {
    font-size: var(--text-body-large-size);
    line-height: var(--text-body-large-line-height);
    font-weight: 500;
    margin-block-end: var(--space-8);
  }

  h6 {
    font-size: var(--text-body-size);
    line-height: var(--text-body-line-height);
    font-weight: 500;
    margin-block-end: var(--space-8);
  }

  p {
    font-family: var(--font-body);
    font-size: var(--text-body-size);
    line-height: var(--text-body-line-height);
    font-weight: var(--text-body-weight);
    color: var(--color-dark-graphite);
    margin-block-end: var(--space-16);
  }

  p:last-child {
    margin-block-end: 0;
  }

  a {
    color: var(--color-bottle-green);
    transition: color var(--transition-fast);
  }

  a:hover {
    color: var(--color-warm-peach);
  }

  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  [tabindex]:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
  }

  ul, ol {
    margin-block-end: var(--space-16);
    padding-inline-start: var(--space-24);
  }

  ul:last-child,
  ol:last-child {
    margin-block-end: 0;
  }

  ul {
    list-style: disc;
  }

  ol {
    list-style: decimal;
  }

  ul ul, ol ol, ul ol, ol ul {
    margin-block-end: 0;
    margin-block-start: var(--space-8);
  }

  blockquote {
    font-family: var(--font-heading);
    font-size: var(--text-h4-size);
    line-height: var(--text-h4-line-height);
    font-weight: 500;
    color: var(--color-bottle-green);
    margin-block-end: var(--space-24);
    padding-inline-start: var(--space-24);
    border-inline-start: 2px solid var(--color-warm-peach);
  }

  blockquote:last-child {
    margin-block-end: 0;
  }

  figure {
    margin-block-end: var(--space-24);
  }

  figure:last-child {
    margin-block-end: 0;
  }

  figcaption {
    font-size: var(--text-caption-size);
    line-height: var(--text-caption-line-height);
    font-weight: var(--text-caption-weight);
    letter-spacing: var(--text-caption-tracking);
    color: var(--color-dark-graphite);
    margin-block-start: var(--space-8);
  }

  hr {
    border: none;
    border-block-start: var(--border-bottle);
    margin-block: var(--space-48);
  }

  code, pre {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
  }

  pre {
    background-color: var(--color-light-stone);
    border-radius: var(--radius-card);
    padding: var(--space-16);
    overflow-x: auto;
    margin-block-end: var(--space-24);
  }

  pre:last-child {
    margin-block-end: 0;
  }

  strong {
    font-weight: 600;
  }

  em {
    font-style: italic;
  }

  small {
    font-size: var(--text-caption-size);
    line-height: var(--text-caption-line-height);
    letter-spacing: var(--text-caption-tracking);
  }

  address {
    font-style: normal;
  }

  fieldset {
    border: none;
    padding: 0;
    margin: 0;
  }

  legend {
    font-family: var(--font-body);
    font-size: var(--text-body-size);
    font-weight: 600;
    color: var(--color-dark-graphite);
    padding: 0;
    margin-block-end: var(--space-8);
  }

  label {
    display: block;
    font-family: var(--font-body);
    font-size: var(--text-caption-size);
    line-height: var(--text-caption-line-height);
    font-weight: 500;
    letter-spacing: var(--text-caption-tracking);
    color: var(--color-dark-graphite);
    margin-block-end: var(--space-8);
  }

  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  input[type="password"],
  input[type="search"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  select,
  textarea {
    display: block;
    width: 100%;
    font-family: var(--font-body);
    font-size: var(--text-body-size);
    line-height: var(--text-body-line-height);
    font-weight: var(--text-body-weight);
    color: var(--color-dark-graphite);
    background-color: var(--color-light-stone);
    border: var(--border-bottle);
    border-radius: var(--radius-field);
    padding: var(--space-12) var(--space-16);
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
    min-height: 44px;
  }

  input[type="text"]:focus,
  input[type="email"]:focus,
  input[type="tel"]:focus,
  input[type="url"]:focus,
  input[type="password"]:focus,
  input[type="search"]:focus,
  input[type="number"]:focus,
  input[type="date"]:focus,
  input[type="time"]:focus,
  input[type="datetime-local"]:focus,
  select:focus,
  textarea:focus {
    border-color: var(--color-bottle-green);
    background-color: var(--color-ivory);
  }

  input::placeholder,
  textarea::placeholder {
    color: rgba(42, 42, 40, 0.55);
  }

  textarea {
    resize: vertical;
    min-height: 120px;
  }

  select {
    appearance: none;
    -webkit-appearance: none;
    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='%232A2A28' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-16) center;
    padding-inline-end: var(--space-48);
  }

  input[type="checkbox"],
  input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-bottle-green);
    margin-inline-end: var(--space-8);
    vertical-align: middle;
  }

  button,
  input[type="submit"],
  input[type="reset"],
  input[type="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-size: var(--text-body-size);
    line-height: 1.2;
    font-weight: 500;
    color: var(--color-dark-graphite);
    background-color: var(--color-warm-peach);
    border: 1px solid transparent;
    border-radius: var(--radius-button);
    padding: var(--space-12) var(--space-24);
    min-height: 44px;
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  }

  button:hover,
  input[type="submit"]:hover,
  input[type="reset"]:hover,
  input[type="button"]:hover {
    background-color: #E0A88A;
  }

  button:active,
  input[type="submit"]:active,
  input[type="reset"]:active,
  input[type="button"]:active {
    background-color: #D09A7C;
  }

  button:disabled,
  input[type="submit"]:disabled,
  input[type="reset"]:disabled,
  input[type="button"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-padding-mobile);
  }

  .display {
    font-family: var(--font-heading);
    font-size: var(--text-display-size);
    line-height: var(--text-display-line-height);
    font-weight: var(--text-display-weight);
    letter-spacing: var(--text-display-tracking);
    color: var(--color-dark-graphite);
    margin-block-end: var(--space-24);
  }

  .display:last-child {
    margin-block-end: 0;
  }

  .overline {
    display: inline-block;
    font-family: var(--font-body);
    font-size: var(--text-overline-size);
    line-height: var(--text-overline-line-height);
    font-weight: var(--text-overline-weight);
    letter-spacing: var(--text-overline-tracking);
    text-transform: uppercase;
    color: var(--color-bottle-green);
    margin-block-end: var(--space-8);
  }

  .overline:last-child {
    margin-block-end: 0;
  }

  .caption {
    font-size: var(--text-caption-size);
    line-height: var(--text-caption-line-height);
    font-weight: var(--text-caption-weight);
    letter-spacing: var(--text-caption-tracking);
    color: var(--color-dark-graphite);
  }

  .body-large {
    font-size: var(--text-body-large-size);
    line-height: var(--text-body-large-line-height);
    font-weight: var(--text-body-large-weight);
  }
}

@layer primitives {
  .card {
    background-color: var(--color-light-stone);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: var(--space-24);
  }

  .card > *:last-child {
    margin-block-end: 0;
  }

  .panel {
    background-color: var(--color-soft-lavender);
    border-radius: var(--radius-card);
    padding: var(--space-24);
  }

  .panel > *:last-child {
    margin-block-end: 0;
  }

  .surface-dark {
    background-color: var(--color-deep-bottle-green);
    color: var(--color-ivory-poker);
  }

  .surface-dark h1,
  .surface-dark h2,
  .surface-dark h3,
  .surface-dark h4,
  .surface-dark h5,
  .surface-dark h6,
  .surface-dark p,
  .surface-dark a,
  .surface-dark .overline,
  .surface-dark .caption {
    color: var(--color-ivory-poker);
  }

  .surface-dark a:hover {
    color: var(--color-warm-peach);
  }

  .surface-dark .overline {
    color: var(--color-lavender-accent);
  }

  .surface-graphite {
    background-color: var(--color-graphite);
    color: var(--color-ivory-poker);
  }

  .surface-graphite h1,
  .surface-graphite h2,
  .surface-graphite h3,
  .surface-graphite h4,
  .surface-graphite h5,
  .surface-graphite h6,
  .surface-graphite p,
  .surface-graphite a,
  .surface-graphite .overline,
  .surface-graphite .caption {
    color: var(--color-ivory-poker);
  }

  .surface-graphite a:hover {
    color: var(--color-warm-peach);
  }

  .surface-graphite .overline {
    color: var(--color-lavender-accent);
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-size: var(--text-body-size);
    line-height: 1.2;
    font-weight: 500;
    color: var(--color-dark-graphite);
    background-color: var(--color-warm-peach);
    border: 1px solid transparent;
    border-radius: var(--radius-button);
    padding: var(--space-12) var(--space-24);
    min-height: 44px;
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  }

  .btn:hover {
    background-color: #E0A88A;
    color: var(--color-dark-graphite);
  }

  .btn:active {
    background-color: #D09A7C;
  }

  .btn-secondary {
    background-color: transparent;
    border: var(--border-bottle);
    color: var(--color-bottle-green);
  }

  .btn-secondary:hover {
    background-color: rgba(31, 77, 58, 0.08);
    color: var(--color-bottle-green);
  }

  .btn-secondary:active {
    background-color: rgba(31, 77, 58, 0.14);
  }

  .tag {
    display: inline-block;
    font-family: var(--font-body);
    font-size: var(--text-caption-size);
    line-height: var(--text-caption-line-height);
    font-weight: 500;
    letter-spacing: var(--text-caption-tracking);
    color: var(--color-dark-graphite);
    background-color: var(--color-soft-lavender);
    border-radius: var(--radius-tag);
    padding: var(--space-4) var(--space-8);
  }

  .tag-accent {
    background-color: var(--color-warm-peach);
  }

  .tag-dark {
    background-color: var(--color-graphite);
    color: var(--color-ivory-poker);
  }

  .tag-lavender {
    background-color: var(--color-lavender-accent);
    color: var(--color-dark-graphite);
  }

  .flex {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-16);
  }

  .flex > * {
    min-width: 0;
  }

  .flex-nowrap {
    flex-wrap: nowrap;
  }

  .flex-column {
    flex-direction: column;
  }

  .flex-align-center {
    align-items: center;
  }

  .flex-align-start {
    align-items: flex-start;
  }

  .flex-align-end {
    align-items: flex-end;
  }

  .flex-justify-start {
    justify-content: flex-start;
  }

  .flex-justify-center {
    justify-content: center;
  }

  .flex-justify-end {
    justify-content: flex-end;
  }

  .flex-justify-between {
    justify-content: space-between;
  }

  .flex-gap-8 {
    gap: var(--space-8);
  }

  .flex-gap-12 {
    gap: var(--space-12);
  }

  .flex-gap-16 {
    gap: var(--space-16);
  }

  .flex-gap-24 {
    gap: var(--space-24);
  }

  .flex-gap-32 {
    gap: var(--space-32);
  }

  .flex-gap-48 {
    gap: var(--space-48);
  }

  .content-list {
    list-style: none;
    padding-inline-start: 0;
    margin-block-end: var(--space-16);
  }

  .content-list:last-child {
    margin-block-end: 0;
  }

  .content-list > li {
    margin-block-end: var(--space-8);
  }

  .content-list > li:last-child {
    margin-block-end: 0;
  }

  .content-list > li::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--color-bottle-green);
    margin-inline-end: var(--space-8);
    vertical-align: middle;
  }

  .content-list-accent > li::before {
    background-color: var(--color-warm-peach);
  }

  .content-list-lavender > li::before {
    background-color: var(--color-lavender-accent);
  }

  .content-list-dark > li::before {
    background-color: var(--color-ivory-poker);
  }

  .content-list-ordered {
    list-style: decimal;
    padding-inline-start: var(--space-24);
  }

  .content-list-ordered > li {
    margin-block-end: var(--space-8);
  }

  .content-list-ordered > li:last-child {
    margin-block-end: 0;
  }

  .content-list-ordered > li::before {
    display: none;
  }

  .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: absolute;
    top: -100%;
    left: var(--space-16);
    z-index: 9999;
    background-color: var(--color-bottle-green);
    color: var(--color-ivory);
    padding: var(--space-12) var(--space-24);
    border-radius: var(--radius-button);
    font-weight: 500;
    transition: top var(--transition-fast);
  }

  .skip-link:focus {
    top: var(--space-16);
  }

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

  .image-ratio-3-2 {
    aspect-ratio: 3 / 2;
    width: 100%;
    object-fit: cover;
  }

  .image-ratio-4-5 {
    aspect-ratio: 4 / 5;
    width: 100%;
    object-fit: cover;
  }

  .image-ratio-16-9 {
    aspect-ratio: 16 / 9;
    width: 100%;
    object-fit: cover;
  }

  .image-radius {
    border-radius: var(--radius-image);
  }
}

@media (min-width: 768px) {
  :root {
    --container-padding-mobile: var(--container-padding-desktop);
  }

  .container {
    padding-inline: var(--container-padding-desktop);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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