@layer reset, tokens, base, primitives;

@layer tokens {
  :root {
    --color-basalt: #0E0F0D;
    --color-basalt-raised: #171916;
    --color-limestone: #E8E1D4;
    --color-ivory: #F4EFE6;
    --color-ivory-muted: #B9B2A6;
    --color-emerald: #0F5C4A;
    --color-emerald-deep: #0A3F33;
    --color-terracotta: #B4552D;
    --color-bronze: #A8824A;
    --color-bronze-soft: #6E5A38;
    --color-smoked-glass: rgba(14, 15, 13, 0.72);
    --color-danger: #C24A3A;

    --font-heading: "Cormorant Garamond", serif;
    --font-body: "Inter", sans-serif;

    --text-display-size: clamp(2.5rem, 5vw + 1rem, 3.5rem);
    --text-display-line-height: 1.05;
    --text-display-letter-spacing: -0.02em;
    --text-display-weight: 500;

    --text-h1-size: clamp(2rem, 3vw + 0.75rem, 2.5rem);
    --text-h1-line-height: 1.1;
    --text-h1-letter-spacing: -0.015em;
    --text-h1-weight: 500;

    --text-h2-size: clamp(1.625rem, 2vw + 0.5rem, 1.875rem);
    --text-h2-line-height: 1.15;
    --text-h2-letter-spacing: -0.01em;
    --text-h2-weight: 500;

    --text-h3-size: 1.375rem;
    --text-h3-line-height: 1.25;
    --text-h3-letter-spacing: 0;
    --text-h3-weight: 500;

    --text-body-lg-size: 1.125rem;
    --text-body-lg-line-height: 1.6;
    --text-body-lg-letter-spacing: 0;
    --text-body-lg-weight: 400;

    --text-body-size: 1rem;
    --text-body-line-height: 1.65;
    --text-body-letter-spacing: 0;
    --text-body-weight: 400;

    --text-small-size: 0.875rem;
    --text-small-line-height: 1.5;
    --text-small-letter-spacing: 0.01em;
    --text-small-weight: 400;

    --text-label-size: 0.75rem;
    --text-label-line-height: 1.4;
    --text-label-letter-spacing: 0.12em;
    --text-label-weight: 500;

    --text-legal-size: 0.8125rem;
    --text-legal-line-height: 1.55;
    --text-legal-letter-spacing: 0;
    --text-legal-weight: 400;

    --space-2xs: 0.25rem;
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1.25rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4.5rem;
    --space-3xl: 6.5rem;
    --space-4xl: 9rem;

    --container-max: 75rem;
    --container-padding-mobile: 1.5rem;
    --container-padding-desktop: 3rem;

    --radius-0: 0;
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-arch: 999px 999px 0 0;

    --border-hairline: 1px solid var(--color-bronze-soft);
    --border-active: 1px solid var(--color-bronze);
    --focus-ring: 2px solid var(--color-bronze);
    --focus-offset: 2px;

    --shadow-overlay: 0 8px 24px rgba(0, 0, 0, 0.35);

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

    --header-height-desktop: 4.5rem;
    --header-height-mobile: 3.75rem;
  }
}

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

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

  body {
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--color-basalt);
    color: var(--color-ivory);
    font-family: var(--font-body);
    font-size: var(--text-body-size);
    font-weight: var(--text-body-weight);
    line-height: var(--text-body-line-height);
    letter-spacing: var(--text-body-letter-spacing);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
  }

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

  input,
  button,
  textarea,
  select {
    font: inherit;
    color: inherit;
  }

  button {
    background: none;
    border: none;
    cursor: pointer;
  }

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

  ul,
  ol {
    list-style: none;
  }

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

  blockquote,
  q {
    quotes: none;
  }

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

  hr {
    border: none;
    border-top: var(--border-hairline);
  }

  fieldset {
    border: none;
  }

  legend {
    padding: 0;
  }

  address {
    font-style: normal;
  }

  :focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
  }

  ::selection {
    background-color: var(--color-emerald);
    color: var(--color-ivory);
  }
}

@layer base {
  body {
    padding-top: var(--header-height-mobile);
  }

  @media (min-width: 48rem) {
    body {
      padding-top: var(--header-height-desktop);
    }
  }

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

  h1 {
    font-size: var(--text-h1-size);
    line-height: var(--text-h1-line-height);
    letter-spacing: var(--text-h1-letter-spacing);
    margin-block-end: var(--space-md);
  }

  h2 {
    font-size: var(--text-h2-size);
    line-height: var(--text-h2-line-height);
    letter-spacing: var(--text-h2-letter-spacing);
    margin-block-end: var(--space-sm);
  }

  h3 {
    font-family: var(--font-body);
    font-size: var(--text-h3-size);
    font-weight: var(--text-h3-weight);
    line-height: var(--text-h3-line-height);
    letter-spacing: var(--text-h3-letter-spacing);
    margin-block-end: var(--space-xs);
  }

  h4,
  h5,
  h6 {
    font-family: var(--font-body);
    font-weight: 500;
    margin-block-end: var(--space-xs);
  }

  p {
    font-size: var(--text-body-size);
    line-height: var(--text-body-line-height);
    margin-block-end: var(--space-md);
  }

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

  ul,
  ol {
    margin-block-end: var(--space-md);
  }

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

  blockquote {
    margin-block-end: var(--space-md);
  }

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

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

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

  figcaption {
    font-size: var(--text-small-size);
    line-height: var(--text-small-line-height);
    letter-spacing: var(--text-small-letter-spacing);
    color: var(--color-ivory-muted);
    margin-block-start: var(--space-xs);
  }

  dl {
    margin-block-end: var(--space-md);
  }

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

  dt {
    font-size: var(--text-label-size);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-letter-spacing);
    text-transform: uppercase;
    color: var(--color-bronze);
    margin-block-end: var(--space-2xs);
  }

  dd {
    margin-block-end: var(--space-sm);
    font-variant-numeric: tabular-nums;
  }

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

  a {
    color: var(--color-ivory);
    text-decoration: underline;
    text-decoration-color: var(--color-bronze);
    text-underline-offset: 0.2em;
    transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
  }

  a:hover {
    color: var(--color-ivory);
    text-decoration-color: var(--color-bronze);
  }

  strong,
  b {
    font-weight: 500;
  }

  em,
  i {
    font-style: italic;
  }

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

  code,
  kbd,
  samp,
  pre {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.875em;
  }

  abbr[title] {
    text-decoration: underline dotted;
    cursor: help;
  }

  mark {
    background-color: var(--color-emerald);
    color: var(--color-ivory);
    padding-inline: 0.2em;
  }

  sub,
  sup {
    font-size: 0.75em;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
  }

  sup {
    top: -0.5em;
  }

  sub {
    bottom: -0.25em;
  }

  hr {
    margin-block: var(--space-lg);
  }

  input,
  select,
  textarea {
    width: 100%;
    background-color: var(--color-basalt-raised);
    border: var(--border-hairline);
    border-radius: var(--radius-sm);
    color: var(--color-ivory);
    font-family: var(--font-body);
    font-size: var(--text-body-size);
    line-height: var(--text-body-line-height);
    padding: var(--space-sm) var(--space-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  }

  input::placeholder,
  textarea::placeholder {
    color: var(--color-ivory-muted);
    opacity: 1;
  }

  input:focus,
  select:focus,
  textarea:focus {
    outline: none;
    border-color: var(--color-bronze);
    box-shadow: 0 0 0 2px var(--color-bronze);
  }

  select {
    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='%23A8824A' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    padding-inline-end: var(--space-lg);
  }

  label {
    display: block;
    font-size: var(--text-label-size);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-letter-spacing);
    text-transform: uppercase;
    color: var(--color-bronze);
    margin-block-end: var(--space-xs);
  }

  fieldset {
    margin-block-end: var(--space-md);
  }

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

  legend {
    font-size: var(--text-label-size);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-letter-spacing);
    text-transform: uppercase;
    color: var(--color-bronze);
    margin-block-end: var(--space-xs);
  }

  button,
  [type="button"],
  [type="submit"],
  [type="reset"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    font-family: var(--font-body);
    font-size: var(--text-label-size);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-letter-spacing);
    text-transform: uppercase;
    text-decoration: none;
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    min-height: 2.75rem;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  }

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

  ::-webkit-scrollbar {
    width: 0.625rem;
  }

  ::-webkit-scrollbar-track {
    background: var(--color-basalt);
  }

  ::-webkit-scrollbar-thumb {
    background: var(--color-bronze-soft);
    border-radius: var(--radius-sm);
  }

  ::-webkit-scrollbar-thumb:hover {
    background: var(--color-bronze);
  }
}

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

  @media (min-width: 48rem) {
    .container {
      padding-inline: var(--container-padding-desktop);
    }
  }

  .container--wide {
    max-width: 90rem;
  }

  .surface-basalt {
    background-color: var(--color-basalt);
  }

  .surface-basalt-raised {
    background-color: var(--color-basalt-raised);
  }

  .surface-limestone {
    background-color: var(--color-limestone);
    color: var(--color-basalt);
  }

  .surface-emerald-deep {
    background-color: var(--color-emerald-deep);
  }

  .surface-smoked-glass {
    background-color: var(--color-smoked-glass);
  }

  .surface-limestone h1,
  .surface-limestone h2,
  .surface-limestone h3,
  .surface-limestone h4,
  .surface-limestone h5,
  .surface-limestone h6 {
    color: var(--color-basalt);
  }

  .surface-limestone p,
  .surface-limestone li,
  .surface-limestone dd {
    color: var(--color-basalt);
  }

  .surface-limestone a {
    color: var(--color-emerald-deep);
    text-decoration-color: var(--color-emerald-deep);
  }

  .surface-limestone a:hover {
    color: var(--color-emerald);
    text-decoration-color: var(--color-emerald);
  }

  .surface-limestone dt,
  .surface-limestone label,
  .surface-limestone legend {
    color: var(--color-emerald-deep);
  }

  .surface-limestone input,
  .surface-limestone select,
  .surface-limestone textarea {
    background-color: var(--color-ivory);
    border-color: var(--color-bronze-soft);
    color: var(--color-basalt);
  }

  .surface-limestone input::placeholder,
  .surface-limestone textarea::placeholder {
    color: var(--color-bronze-soft);
  }

  .card {
    background-color: var(--color-basalt-raised);
    border: var(--border-hairline);
    border-radius: var(--radius-md);
    padding: var(--space-md);
  }

  .card--limestone {
    background-color: var(--color-limestone);
    color: var(--color-basalt);
  }

  .card--emerald-deep {
    background-color: var(--color-emerald-deep);
    border-color: var(--color-emerald);
  }

  .card--limestone h1,
  .card--limestone h2,
  .card--limestone h3,
  .card--limestone h4,
  .card--limestone h5,
  .card--limestone h6 {
    color: var(--color-basalt);
  }

  .card--limestone p,
  .card--limestone li,
  .card--limestone dd {
    color: var(--color-basalt);
  }

  .card--limestone a {
    color: var(--color-emerald-deep);
    text-decoration-color: var(--color-emerald-deep);
  }

  .card--limestone a:hover {
    color: var(--color-emerald);
    text-decoration-color: var(--color-emerald);
  }

  .card--limestone dt,
  .card--limestone label,
  .card--limestone legend {
    color: var(--color-emerald-deep);
  }

  .card--limestone input,
  .card--limestone select,
  .card--limestone textarea {
    background-color: var(--color-ivory);
    border-color: var(--color-bronze-soft);
    color: var(--color-basalt);
  }

  .card--limestone input::placeholder,
  .card--limestone textarea::placeholder {
    color: var(--color-bronze-soft);
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    font-family: var(--font-body);
    font-size: var(--text-label-size);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-letter-spacing);
    text-transform: uppercase;
    text-decoration: none;
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    min-height: 2.75rem;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    border: 1px solid transparent;
  }

  .btn--primary {
    background-color: var(--color-emerald);
    color: var(--color-ivory);
    border-color: var(--color-emerald);
  }

  .btn--primary:hover {
    background-color: var(--color-emerald-deep);
    border-color: var(--color-emerald-deep);
    color: var(--color-ivory);
  }

  .btn--secondary {
    background-color: transparent;
    color: var(--color-ivory);
    border-color: var(--color-bronze);
  }

  .btn--secondary:hover {
    background-color: var(--color-basalt-raised);
    border-color: var(--color-bronze);
    color: var(--color-ivory);
  }

  .btn--terracotta {
    background-color: var(--color-terracotta);
    color: var(--color-ivory);
    border-color: var(--color-terracotta);
  }

  .btn--terracotta:hover {
    background-color: var(--color-emerald-deep);
    border-color: var(--color-emerald-deep);
    color: var(--color-ivory);
  }

  .btn--limestone {
    background-color: var(--color-limestone);
    color: var(--color-basalt);
    border-color: var(--color-limestone);
  }

  .btn--limestone:hover {
    background-color: var(--color-ivory);
    border-color: var(--color-ivory);
    color: var(--color-basalt);
  }

  .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-label-size);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-letter-spacing);
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    padding: var(--space-2xs) var(--space-xs);
    min-height: 1.5rem;
  }

  .badge--emerald {
    background-color: var(--color-emerald);
    color: var(--color-ivory);
  }

  .badge--outline {
    background-color: transparent;
    color: var(--color-ivory-muted);
    border: var(--border-hairline);
  }

  .badge--terracotta {
    background-color: var(--color-terracotta);
    color: var(--color-ivory);
  }

  .badge--limestone {
    background-color: var(--color-limestone);
    color: var(--color-basalt);
  }

  .divider {
    border: none;
    border-top: var(--border-hairline);
    margin-block: var(--space-lg);
  }

  .divider--accent {
    width: 4rem;
    border-top: 1px solid var(--color-bronze);
    margin-block: var(--space-md);
  }

  .divider--accent-center {
    width: 4rem;
    border-top: 1px solid var(--color-bronze);
    margin-block: var(--space-md);
    margin-inline: auto;
  }

  .section-label {
    font-size: var(--text-label-size);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-letter-spacing);
    text-transform: uppercase;
    color: var(--color-bronze);
    margin-block-end: var(--space-xs);
  }

  .section-label--terracotta {
    color: var(--color-terracotta);
  }

  .section-label--limestone {
    color: var(--color-emerald-deep);
  }

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

  .display--limestone {
    color: var(--color-basalt);
  }

  .lead {
    font-size: var(--text-body-lg-size);
    line-height: var(--text-body-lg-line-height);
    letter-spacing: var(--text-body-lg-letter-spacing);
    font-weight: var(--text-body-lg-weight);
    margin-block-end: var(--space-md);
  }

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

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

  .text-legal {
    font-size: var(--text-legal-size);
    line-height: var(--text-legal-line-height);
    letter-spacing: var(--text-legal-letter-spacing);
    color: var(--color-ivory-muted);
  }

  .text-label {
    font-size: var(--text-label-size);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-letter-spacing);
    text-transform: uppercase;
    color: var(--color-bronze);
  }

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

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

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

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

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

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

  .tabular-nums {
    font-variant-numeric: tabular-nums;
  }

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

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

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

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

  .visually-hidden {
    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-md);
    z-index: 1000;
    background-color: var(--color-emerald);
    color: var(--color-ivory);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--text-label-size);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-letter-spacing);
    text-transform: uppercase;
    text-decoration: none;
    transition: top var(--transition-fast);
  }

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

  .content-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }

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

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

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

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

  .flex {
    display: flex;
  }

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

  .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-center {
    justify-content: center;
  }

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

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

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

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

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

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

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

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

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

  .flex > img,
  .flex > picture,
  .flex > video,
  .flex > svg {
    flex-shrink: 0;
  }

  .grid {
    display: grid;
    gap: var(--space-md);
  }

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

  .grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .grid--gap-sm {
    gap: var(--space-sm);
  }

  .grid--gap-md {
    gap: var(--space-md);
  }

  .grid--gap-lg {
    gap: var(--space-lg);
  }

  .grid--gap-xl {
    gap: var(--space-xl);
  }

  @media (max-width: 47.999rem) {
    .grid--2,
    .grid--3,
    .grid--4 {
      grid-template-columns: 1fr;
    }
  }

  @media (min-width: 48rem) and (max-width: 63.999rem) {
    .grid--4 {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
}