@layer reset, tokens, base, primitives;

@layer tokens {
  :root {
    --dt-ink: #202225;
    --dt-ink-raised: #2A2D31;
    --dt-ivory: #F2EFE9;
    --dt-teal: #1F5C5D;
    --dt-ember: #C46B3B;
    --dt-slate: #6F757A;
    --dt-brass: #A88A55;

    --dt-border-ivory: rgba(242, 239, 233, 0.15);
    --dt-border-ivory-strong: rgba(242, 239, 233, 0.28);

    --dt-font-heading: "Space Grotesk", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --dt-font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --dt-space-1: 4px;
    --dt-space-2: 8px;
    --dt-space-3: 16px;
    --dt-space-4: 24px;
    --dt-space-5: 32px;
    --dt-space-6: 48px;
    --dt-space-7: 64px;
    --dt-space-8: 96px;
    --dt-space-9: 128px;

    --dt-container-max: 1200px;
    --dt-container-padding: var(--dt-space-4);
    --dt-gutter: 24px;

    --dt-radius-sharp: 0px;
    --dt-radius-small: 4px;
    --dt-radius-input: 8px;
    --dt-radius-pill: 999px;

    --dt-shadow-float: 0 12px 32px rgba(0, 0, 0, 0.22);
    --dt-shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.32);

    --dt-transition-fast: 150ms ease-in-out;

    --dt-focus-ring: 2px solid var(--dt-teal);
    --dt-focus-offset: 2px;
  }
}

@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-width: 320px;
    overflow-x: hidden;
    background-color: var(--dt-ink);
    color: var(--dt-ivory);
    font-family: var(--dt-font-body);
    font-size: 16px;
    line-height: 1.6;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  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;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    overflow-wrap: break-word;
    text-wrap: balance;
  }

  p {
    overflow-wrap: break-word;
    text-wrap: pretty;
  }

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

  :focus-visible {
    outline: var(--dt-focus-ring);
    outline-offset: var(--dt-focus-offset);
    border-radius: var(--dt-radius-small);
  }

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

@layer base {
  body {
    font-size: 16px;
    line-height: 1.6;
  }

  .display {
    font-family: var(--dt-font-heading);
    font-size: clamp(2.75rem, 5.5vw + 1rem, 4rem);
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  h1 {
    font-family: var(--dt-font-heading);
    font-size: clamp(2.25rem, 4vw + 0.75rem, 3rem);
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin-block-end: var(--dt-space-4);
  }

  h2 {
    font-family: var(--dt-font-heading);
    font-size: clamp(1.75rem, 3vw + 0.5rem, 2.25rem);
    line-height: 1.25;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-block-end: var(--dt-space-4);
  }

  h3 {
    font-family: var(--dt-font-heading);
    font-size: clamp(1.375rem, 2vw + 0.5rem, 1.75rem);
    line-height: 1.3;
    font-weight: 600;
    margin-block-end: var(--dt-space-3);
  }

  h4 {
    font-family: var(--dt-font-heading);
    font-size: 1.25rem;
    line-height: 1.4;
    font-weight: 600;
    margin-block-end: var(--dt-space-3);
  }

  p {
    font-size: 1rem;
    line-height: 1.6;
    margin-block-end: var(--dt-space-3);
  }

  .text-large {
    font-size: 1.125rem;
    line-height: 1.6;
    font-weight: 400;
  }

  .caption {
    font-size: 0.875rem;
    line-height: 1.5;
    font-weight: 400;
    color: var(--dt-slate);
  }

  .eyebrow {
    display: inline-block;
    font-family: var(--dt-font-heading);
    font-size: 0.875rem;
    line-height: 1.5;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--dt-teal);
    margin-block-end: var(--dt-space-2);
  }

  blockquote {
    margin-block-end: var(--dt-space-4);
    padding-inline-start: var(--dt-space-4);
    border-inline-start: 2px solid var(--dt-brass);
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--dt-ivory);
  }

  ul:not([class]),
  ol:not([class]) {
    margin-block-end: var(--dt-space-4);
    padding-inline-start: var(--dt-space-4);
  }

  ul:not([class]) {
    list-style: disc;
  }

  ol:not([class]) {
    list-style: decimal;
  }

  ul:not([class]) li,
  ol:not([class]) li {
    margin-block-end: var(--dt-space-2);
  }

  ul:not([class]) li:last-child,
  ol:not([class]) li:last-child {
    margin-block-end: 0;
  }

  ul:not([class]) li::marker,
  ol:not([class]) li::marker {
    color: var(--dt-brass);
  }

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

  figcaption {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--dt-slate);
    margin-block-start: var(--dt-space-2);
  }

  hr {
    border: none;
    border-block-start: 1px solid var(--dt-border-ivory);
    margin-block: var(--dt-space-6);
  }

  address {
    font-style: normal;
  }

  small {
    font-size: 0.875rem;
    line-height: 1.5;
  }

  strong {
    font-weight: 600;
  }

  em {
    font-style: italic;
  }

  mark {
    background-color: var(--dt-teal);
    color: var(--dt-ivory);
    padding-inline: var(--dt-space-1);
  }

  code,
  kbd,
  samp {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875em;
    background-color: var(--dt-ink-raised);
    padding: 0.2em 0.4em;
    border-radius: var(--dt-radius-small);
  }

  pre {
    background-color: var(--dt-ink-raised);
    padding: var(--dt-space-4);
    border-radius: var(--dt-radius-small);
    overflow-x: auto;
    margin-block-end: var(--dt-space-4);
  }

  pre code {
    background: none;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.6;
  }

  :where(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, figure, pre, table, hr) {
    margin-block-start: 0;
  }

  :where(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, figure, pre, table) {
    margin-block-end: var(--dt-space-4);
  }

  :where(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, figure, pre, table):last-child {
    margin-block-end: 0;
  }

  label {
    display: block;
    font-size: 0.875rem;
    line-height: 1.5;
    font-weight: 500;
    margin-block-end: var(--dt-space-2);
    color: var(--dt-ivory);
  }

  input,
  textarea,
  select {
    width: 100%;
    background-color: transparent;
    border: none;
    border-block-end: 1px solid var(--dt-border-ivory-strong);
    padding: var(--dt-space-2) 0;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--dt-ivory);
    border-radius: 0;
    transition: border-color var(--dt-transition-fast);
  }

  input::placeholder,
  textarea::placeholder {
    color: var(--dt-slate);
    opacity: 1;
  }

  input:focus,
  textarea:focus,
  select:focus {
    outline: none;
    border-block-end-color: var(--dt-teal);
  }

  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='%23F2EFE9' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    padding-inline-end: var(--dt-space-4);
  }

  select option {
    background-color: var(--dt-ink);
    color: var(--dt-ivory);
  }

  fieldset {
    border: 1px solid var(--dt-border-ivory);
    padding: var(--dt-space-4);
    margin-block-end: var(--dt-space-4);
  }

  legend {
    font-family: var(--dt-font-heading);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-inline: var(--dt-space-2);
    color: var(--dt-brass);
  }
}

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

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

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

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

  .surface-card {
    background-color: var(--dt-ink-raised);
    border: 1px solid var(--dt-border-ivory);
    border-radius: var(--dt-radius-sharp);
    padding: var(--dt-space-4);
  }

  .surface-light {
    background-color: var(--dt-ivory);
    color: var(--dt-ink);
    border-radius: var(--dt-radius-sharp);
    padding: var(--dt-space-4);
  }

  .surface-light .caption {
    color: var(--dt-slate);
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--dt-space-2);
    font-family: var(--dt-font-heading);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.2;
    padding: var(--dt-space-3) var(--dt-space-5);
    border-radius: var(--dt-radius-sharp);
    border: 1px solid transparent;
    transition: background-color var(--dt-transition-fast), color var(--dt-transition-fast), border-color var(--dt-transition-fast);
    white-space: nowrap;
    min-height: 48px;
  }

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

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

  .btn-primary:active {
    background-color: var(--dt-ink-raised);
  }

  .btn-accent {
    background-color: var(--dt-ember);
    color: var(--dt-ivory);
    border-color: var(--dt-ember);
  }

  .btn-accent:hover {
    background-color: #a85a32;
    border-color: #a85a32;
  }

  .btn-accent:active {
    background-color: #8f4c2a;
  }

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

  .btn-teal:hover {
    background-color: var(--dt-ink);
    color: var(--dt-ivory);
    border-color: var(--dt-ivory);
  }

  .btn-teal:active {
    background-color: var(--dt-ink-raised);
  }

  .btn-outline {
    background-color: transparent;
    color: var(--dt-ivory);
    border-color: var(--dt-border-ivory-strong);
  }

  .btn-outline:hover {
    background-color: var(--dt-ivory);
    color: var(--dt-ink);
    border-color: var(--dt-ivory);
  }

  .btn-outline:active {
    background-color: var(--dt-ink-raised);
    color: var(--dt-ivory);
  }

  .btn-small {
    padding: var(--dt-space-2) var(--dt-space-4);
    font-size: 0.75rem;
    min-height: 36px;
  }

  .btn-large {
    padding: var(--dt-space-4) var(--dt-space-6);
    font-size: 1rem;
    min-height: 56px;
  }

  .badge {
    display: inline-flex;
    align-items: center;
    gap: var(--dt-space-1);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.2;
    padding: var(--dt-space-1) var(--dt-space-3);
    border-radius: var(--dt-radius-pill);
    background-color: var(--dt-teal);
    color: var(--dt-ivory);
    white-space: nowrap;
  }

  .badge-ember {
    background-color: var(--dt-ember);
  }

  .badge-brass {
    background-color: var(--dt-brass);
    color: var(--dt-ink);
  }

  .badge-outline {
    background-color: transparent;
    border: 1px solid var(--dt-border-ivory-strong);
    color: var(--dt-ivory);
  }

  .chip {
    display: inline-flex;
    align-items: center;
    gap: var(--dt-space-2);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    padding: var(--dt-space-2) var(--dt-space-3);
    border-radius: var(--dt-radius-small);
    background-color: var(--dt-ink-raised);
    border: 1px solid var(--dt-border-ivory);
    color: var(--dt-ivory);
  }

  .link-underline {
    position: relative;
    display: inline-block;
    font-weight: 500;
    color: var(--dt-ivory);
    transition: color var(--dt-transition-fast);
  }

  .link-underline::after {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    inset-block-end: -2px;
    width: 100%;
    height: 1px;
    background-color: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--dt-transition-fast);
  }

  .link-underline:hover {
    color: var(--dt-teal);
  }

  .link-underline:hover::after {
    transform: scaleX(1);
    transform-origin: left;
  }

  .flex {
    display: flex;
  }

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

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

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

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

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

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

  .items-stretch {
    align-items: stretch;
  }

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

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

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

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

  .justify-around {
    justify-content: space-around;
  }

  .gap-1 {
    gap: var(--dt-space-1);
  }

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

  .gap-3 {
    gap: var(--dt-space-3);
  }

  .gap-4 {
    gap: var(--dt-space-4);
  }

  .gap-5 {
    gap: var(--dt-space-5);
  }

  .gap-6 {
    gap: var(--dt-space-6);
  }

  .flex-1 {
    flex: 1 1 0%;
    min-width: 0;
  }

  .flex-auto {
    flex: 1 1 auto;
    min-width: 0;
  }

  .flex-none {
    flex: none;
  }

  .grow {
    flex-grow: 1;
  }

  .grow-0 {
    flex-grow: 0;
  }

  .shrink {
    flex-shrink: 1;
  }

  .shrink-0 {
    flex-shrink: 0;
  }

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

  .self-center {
    align-self: center;
  }

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

  .self-stretch {
    align-self: stretch;
  }

  .text-left {
    text-align: left;
  }

  .text-center {
    text-align: center;
  }

  .text-right {
    text-align: right;
  }

  .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;
  }

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

  .truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .aspect-4-3 {
    aspect-ratio: 4 / 3;
  }

  .aspect-16-9 {
    aspect-ratio: 16 / 9;
  }

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

  .img-contain {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .overlay-dark {
    position: relative;
  }

  .overlay-dark::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(32, 34, 37, 0.35), rgba(32, 34, 37, 0.75));
    pointer-events: none;
  }

  .overlay-dark > * {
    position: relative;
    z-index: 1;
  }
}

@media (max-width: 767px) {
  @layer primitives {
    .section {
      padding-block: var(--dt-space-7);
    }

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

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

    .container {
      padding-inline: var(--dt-space-3);
    }

    .btn {
      padding: var(--dt-space-3) var(--dt-space-4);
      font-size: 0.8125rem;
    }

    .btn-large {
      padding: var(--dt-space-3) var(--dt-space-5);
      font-size: 0.9375rem;
      min-height: 52px;
    }
  }
}

@media (max-width: 479px) {
  @layer primitives {
    .section {
      padding-block: var(--dt-space-6);
    }

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

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

    .container {
      padding-inline: var(--dt-space-3);
    }
  }
}