@layer reset, base, layout, components;

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

  html {
    scroll-behavior: smooth;
  }

  body,
  h1,
  h2,
  h3,
  p,
  ol {
    margin: 0;
  }

  ol {
    padding: 0;
    list-style: none;
  }

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

@layer base {
  :root {
    --paper: #fff;
    --ink: #000;
    --muted: #000;
    --quiet-ink: #737373;
    --line: #000;
    --soft-line: #d9d9d9;
    --accent: #000;
    --focus: #000;
    --stamp: #d9aa18;
    --stamp-ink: #ef2529;
    --page-gutter: clamp(1.25rem, 4.5vw, 4.5rem);
    --page-width: 86rem;
    --display: "la-mericana", Georgia, "Times New Roman", serif;
    --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  }

  html {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  body {
    min-width: 20rem;
    background: var(--paper);
    overflow-x: clip;
  }

  ::selection {
    background: var(--accent);
    color: var(--paper);
  }

  :focus-visible {
    outline: 0.1875rem solid var(--focus);
    outline-offset: 0.25rem;
  }

  [id] {
    scroll-margin-top: 6rem;
  }
}

@layer layout {
  .page-shell {
    width: min(100%, var(--page-width));
    margin-inline: auto;
    padding-inline: var(--page-gutter);
  }

  .site-header {
    position: fixed;
    z-index: 20;
    inset-block-start: 0;
    inset-inline: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    width: min(100%, var(--page-width));
    min-height: 6rem;
    margin-inline: auto;
    padding: 1.75rem var(--page-gutter);
  }

  .section {
    display: grid;
    grid-template-columns: minmax(7rem, 1fr) minmax(0, 4fr);
    gap: clamp(2rem, 6vw, 7rem);
    padding-block: clamp(6rem, 11vw, 10rem);
  }

  .hero {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    gap: 3rem;
    min-height: 100svh;
    padding-block: calc(6rem + clamp(2rem, 6vh, 5rem)) clamp(3rem, 8vh, 6rem);
    overflow: visible;
    isolation: isolate;
  }

  .hero-content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: minmax(14rem, 0.85fr) minmax(0, 2.15fr);
    gap: clamp(3rem, 7vw, 8rem);
    align-self: center;
    align-items: start;
    min-width: 0;
  }

  .hero-intro,
  .hero-copy,
  .hero-link {
    position: relative;
    z-index: 1;
  }

  .hero-intro {
    grid-column: 1;
    align-self: start;
    transform: translateY(clamp(1.25rem, 1.7vw, 2rem));
  }

  .hero-copy {
    grid-column: 2;
    align-self: start;
    min-width: 0;
  }

  .hero-link {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    align-self: end;
  }

  .experience-section {
    display: block;
  }

  .contact {
    display: grid;
    grid-template-columns: minmax(14rem, 2fr) minmax(22rem, 3fr);
    gap: clamp(2rem, 6vw, 7rem);
    padding-block: clamp(7rem, 13vw, 13rem);
  }

  .site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 6rem;
  }
}

@layer components {
  .skip-link {
    position: fixed;
    z-index: 100;
    inset-block-start: 1rem;
    inset-inline-start: 1rem;
    padding: 0.75rem 1rem;
    transform: translateY(-200%);
    background: var(--ink);
    color: var(--paper);
    font-size: 0.875rem;
    font-weight: 600;
  }

  .skip-link:focus {
    transform: translateY(0);
  }

  .section-label,
  .site-footer {
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.4;
  }

  .site-nav {
    display: flex;
    gap: clamp(0.25rem, 1vw, 0.75rem);
  }

  .site-nav a {
    display: inline-flex;
    min-width: 0;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    padding-inline: clamp(0.5rem, 1vw, 0.875rem);
    background: var(--paper);
    color: var(--muted);
    font-size: 0.8125rem;
    transition: color 120ms ease-out;
  }

  .site-nav a:hover,
  .site-nav a[aria-current="location"] {
    color: var(--ink);
  }

  .hero h1 {
    width: 100%;
    max-width: none;
    font-family: var(--display);
    font-size: clamp(4rem, 7.5vw, 7.75rem);
    font-weight: 400;
    letter-spacing: -0.035em;
    line-height: 1.12;
  }

  .hero-title-line {
    display: block;
    white-space: nowrap;
  }

  .hero-background {
    position: absolute;
    z-index: 0;
    inset-block: 0;
    inset-inline: calc((100vw - 100%) / -2);
    overflow: hidden;
    background-image: repeating-linear-gradient(
      to right,
      #e8e8e8 0,
      #e8e8e8 1px,
      transparent 1px,
      transparent 66px
    );
    pointer-events: none;
  }

  .hero-background[data-rendered] {
    background-image: none;
  }

  .hero-print-lines {
    display: block;
    width: 100%;
    height: 100%;
  }

  .hero-stamp {
    position: absolute;
    inset-block-end: calc(100% + 1.125rem);
    inset-inline-start: -0.375rem;
    width: clamp(4rem, 5.333vw, 5rem);
    aspect-ratio: 1;
    transform: rotate(-12deg);
  }

  .hero-stamp svg {
    display: block;
    width: 100%;
    height: 100%;
  }

  .hero-stamp-paper {
    fill: var(--stamp);
  }

  .hero-stamp-symbol {
    fill: var(--stamp-ink);
  }

  .hero-stamp-grain {
    opacity: 0.18;
    mix-blend-mode: multiply;
    pointer-events: none;
  }

  .hero-signature {
    position: absolute;
    inset-block-end: calc(100% + 0.5rem);
    inset-inline-start: -0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--ink);
  }

  .hero-signature img {
    display: block;
    width: clamp(4rem, 5.5vw, 5.25rem);
    height: auto;
  }

  .hero-signature img + img {
    margin-block-start: -1.25rem;
  }

  .hero-introduction {
    max-width: 26rem;
    color: var(--muted);
    font-size: clamp(1.125rem, 1.5vw, 1.375rem);
    line-height: 1.6;
    text-wrap: pretty;
  }

  .hero-description {
    max-width: 36rem;
    margin-block-start: 3rem;
    padding-inline-start: clamp(0.5rem, 0.8vw, 0.875rem);
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.7;
    text-wrap: pretty;
  }

  .text-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.75rem;
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration-line: underline;
    text-decoration-color: var(--line);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.35rem;
    text-decoration-skip-ink: auto;
    transition: color 120ms ease-out, text-decoration-color 120ms ease-out;
  }

  .text-link:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
  }

  .section-label {
    padding-block-start: 0.55rem;
    letter-spacing: 0.01em;
  }

  .section h2,
  .contact h2 {
    max-width: 13ch;
    font-family: var(--display);
    font-size: clamp(2.75rem, 5.5vw, 5.75rem);
    font-weight: 400;
    letter-spacing: -0.035em;
    line-height: 0.98;
    text-wrap: balance;
  }

  .section .experience-title {
    max-width: none;
    font-size: clamp(2.333rem, 4vw, 4.333rem);
    line-height: 1;
  }

  .work-section {
    position: relative;
    display: block;
    isolation: isolate;
  }

  .work-section::before {
    position: absolute;
    z-index: 0;
    inset-block: 0;
    inset-inline: calc((100vw - 100%) / -2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Ccircle cx='18' cy='18' r='1.5' fill='%23dedede'/%3E%3C/svg%3E");
    background-position: center top;
    background-size: 36px 36px;
    content: "";
    pointer-events: none;
  }

  .work-section .section-body {
    position: relative;
    z-index: 1;
  }

  .section.work-section h2 {
    max-width: none;
    font-size: clamp(2.333rem, 4vw, 4.333rem);
    line-height: 1;
    text-align: center;
  }

  .work-list {
    display: flex;
    block-size: 19rem;
    margin-block-start: clamp(4rem, 8vw, 7rem);
    overflow: hidden;
  }

  .work-more {
    display: block;
    width: fit-content;
    margin: clamp(2.5rem, 4vw, 4rem) auto 0;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration-line: underline;
    text-decoration-thickness: from-font;
    text-underline-offset: 0.3em;
  }

  .work-item {
    display: flex;
    min-width: 0;
    min-height: clamp(14rem, 20vw, 18rem);
    flex: 1 1 0;
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem clamp(1.5rem, 3vw, 3.5rem);
    transition:
      color 120ms ease-out,
      flex-grow 300ms cubic-bezier(0.2, 0, 0, 1);
  }

  .work-item:not(:first-child) {
    border-inline-start: 1px solid var(--soft-line);
  }

  .work-item:hover {
    color: var(--accent);
  }

  .work-logo {
    display: block;
    width: clamp(3.75rem, 5vw, 4.75rem);
    height: auto;
    margin-block-end: 1rem;
    object-fit: contain;
  }

  .work-heading {
    position: relative;
    display: block;
    width: 100%;
    margin-block-end: 1rem;
  }

  .work-name {
    font-family: var(--sans);
    font-size: clamp(1.375rem, 1.8vw, 1.625rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
  }

  .work-description {
    display: block;
    max-width: 32rem;
    color: var(--muted);
    font-size: 0.9375rem;
    line-height: 1.6;
    text-wrap: pretty;
  }

  .work-description--short {
    max-height: 5rem;
    overflow: hidden;
    opacity: 1;
    transform: translateY(0);
    transition:
      max-height 240ms cubic-bezier(0.2, 0, 0, 1),
      opacity 120ms ease-out,
      transform 180ms ease-out;
  }

  .work-description--long {
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    transform: translateY(0.5rem);
    transition:
      max-height 300ms cubic-bezier(0.2, 0, 0, 1),
      opacity 140ms ease-out,
      transform 240ms cubic-bezier(0.2, 0, 0, 1),
      visibility 0s linear 300ms;
  }

  .work-visit {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-end: 0;
    visibility: hidden;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(calc(-50% + 0.5rem));
    transition:
      opacity 120ms ease-out,
      transform 220ms cubic-bezier(0.2, 0, 0, 1),
      visibility 0s linear 220ms;
  }

  .work-item:focus-visible .work-description--short,
  .work-list:has(.work-item:focus-visible)
    .work-item:not(:focus-visible)
    .work-description--short {
    max-height: 0;
    opacity: 0;
    transform: translateY(-0.25rem);
  }

  .work-item:focus-visible .work-description--long {
    max-height: 24rem;
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0s;
  }

  .work-item:focus-visible .work-visit {
    visibility: visible;
    opacity: 1;
    transform: translateY(-50%);
    transition-delay: 0s;
  }

  .work-list:has(.work-item:focus-visible) .work-item {
    flex-grow: 0.68;
  }

  .work-list:has(.work-item:focus-visible) .work-item:focus-visible {
    flex-grow: 1.64;
  }

  @media (hover: hover) and (pointer: fine) {
    .work-list:has(.work-item:hover) .work-item {
      flex-grow: 0.68;
    }

    .work-list:has(.work-item:hover) .work-item:hover {
      flex-grow: 1.64;
    }

    .work-item:hover .work-description--short,
    .work-list:has(.work-item:hover) .work-item:not(:hover) .work-description--short {
      max-height: 0;
      opacity: 0;
      transform: translateY(-0.25rem);
    }

    .work-item:hover .work-description--long {
      max-height: 24rem;
      visibility: visible;
      opacity: 1;
      transform: translateY(0);
      transition-delay: 0s;
    }

    .work-item:hover .work-visit {
      visibility: visible;
      opacity: 1;
      transform: translateY(-50%);
      transition-delay: 0s;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .work-item,
    .work-description--short,
    .work-description--long,
    .work-visit {
      transition: none;
    }
  }

  .experience-list {
    width: 100%;
    margin-block-start: clamp(4rem, 8vw, 7rem);
  }

  .experience-list li {
    position: relative;
    width: 100%;
    padding-block: 2rem;
    border-block-start: 1px solid var(--soft-line);
  }

  .experience-list li::before {
    position: absolute;
    inset-block-start: -1px;
    inset-inline-start: 0;
    width: 100%;
    height: 1px;
    background: var(--ink);
    content: "";
    pointer-events: none;
    transform: scaleX(0);
    transform-origin: left center;
  }

  .experience-list li:last-child {
    border-block-end: 1px solid var(--soft-line);
  }

  @media (hover: hover) and (pointer: fine) {
    .experience-list li::before {
      transition: transform 300ms cubic-bezier(0.2, 0, 0, 1);
    }

    .experience-list li:hover::before {
      transform: scaleX(1);
    }
  }

  .experience-details {
    display: grid;
    grid-template-columns: minmax(10rem, 0.8fr) minmax(12rem, 1fr) minmax(0, 1.6fr);
    column-gap: clamp(1.5rem, 4vw, 4rem);
    row-gap: 0.75rem;
    align-items: start;
    width: 100%;
  }

  .experience-context {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
  }

  .experience-role {
    display: flex;
    min-height: clamp(1.8375rem, 2.625vw, 2.625rem);
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    margin-block-start: 1.9625rem;
  }

  .experience-list h3 {
    font-family: var(--sans);
    font-size: clamp(1rem, 1.25vw, 1.125rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.35;
    text-wrap: pretty;
  }

  .experience-role-detail {
    color: var(--quiet-ink);
    font-size: 0.8125rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.45;
  }

  .experience-company {
    font-family: var(--display);
    font-size: clamp(1.75rem, 2.5vw, 2.5rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.05;
  }

  .experience-company-animated {
    display: inline-flex;
    white-space: pre;
  }

  .experience-company-character {
    position: relative;
    display: inline-block;
    overflow: hidden;
    perspective: 1.5em;
  }

  .experience-company-face {
    display: inline-block;
    transform-style: preserve-3d;
  }

  .experience-company-face--front {
    transform: translateY(0) rotateX(0deg);
    transform-origin: center top;
  }

  .experience-company-face--back {
    position: absolute;
    inset: 0;
    color: var(--stamp-ink);
    opacity: 0;
    transform: translateY(90%) rotateX(-75deg);
    transform-origin: center bottom;
  }

  .experience-company-space {
    display: inline-block;
    width: 0.3em;
  }

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

  @media (hover: hover) and (pointer: fine) {
    .experience-list li:hover .experience-company-face--front {
      opacity: 0;
      transform: translateY(-90%) rotateX(75deg);
    }

    .experience-list li:hover .experience-company-face--back {
      opacity: 1;
      transform: translateY(0) rotateX(0deg);
    }
  }

  @media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    .experience-company-face {
      transition:
        color 180ms ease-out,
        opacity 180ms ease-out,
        transform 240ms cubic-bezier(0.2, 0, 0, 1);
      transition-delay: calc(var(--reverse-index) * 40ms);
    }

    .experience-list li:hover .experience-company-face {
      transition-delay: calc(var(--letter-index) * 40ms);
    }
  }

  .experience-meta {
    color: var(--quiet-ink);
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
  }

  .experience-description {
    max-width: 46rem;
    color: var(--muted);
    font-size: clamp(1rem, 1.25vw, 1.125rem);
    line-height: 1.65;
    text-wrap: pretty;
  }

  .experience-keywords {
    grid-column: 3;
    color: var(--quiet-ink);
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
    line-height: 1.5;
  }

  .contact > .contact-title {
    max-width: none;
    font-size: clamp(2rem, 3.2vw, 3.5rem);
    line-height: 1;
  }

  .contact-title span {
    display: block;
  }

  .contact-links {
    display: flex;
    flex-direction: column;
  }

  .contact-links .text-link {
    width: 100%;
    justify-content: space-between;
    gap: 2rem;
    padding-block: 1.25rem;
    border-block-end: 1px solid var(--soft-line);
    font-size: clamp(1.125rem, 1.5vw, 1.375rem);
    line-height: 1.4;
    text-decoration: none;
  }

  .site-footer a {
    display: inline-flex;
    min-width: 5rem;
    min-height: 2.75rem;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    color: var(--ink);
  }

  @media (max-width: 50rem) {
    .section,
    .contact {
      grid-template-columns: 1fr;
      gap: 2rem;
    }

    .hero {
      grid-template-rows: 1fr auto;
    }

    .hero-content {
      grid-template-columns: 1fr;
      gap: clamp(4rem, 10vw, 6rem);
    }

    .hero-intro,
    .hero-copy {
      grid-column: 1;
    }

    .hero-intro {
      transform: none;
    }

    .hero-title-line {
      white-space: normal;
    }

    .experience-details {
      grid-template-columns: minmax(9rem, 0.7fr) minmax(0, 1.5fr);
      gap: 0.75rem 2rem;
      align-items: start;
    }

    .experience-context {
      grid-column: 1;
      grid-row: 1;
    }

    .experience-role,
    .experience-description,
    .experience-keywords {
      grid-column: 2;
    }

  }

  @media (max-width: 34rem) {
    .site-header {
      min-height: 5rem;
      padding-block: 1.25rem;
    }

    .site-nav {
      gap: 0.25rem;
    }

    .site-nav a {
      padding-inline: 0.45rem;
    }

    .hero {
      min-height: 100svh;
      padding-block: 7rem 3rem;
    }

    .hero h1 {
      font-size: clamp(3.25rem, 14vw, 4.75rem);
      line-height: 1.1;
    }

    .hero-introduction {
      max-width: 22rem;
      font-size: 1.0625rem;
    }

    .hero-description {
      max-width: 23rem;
      padding-inline-start: 0.5rem;
      font-size: 0.9375rem;
    }

    .section,
    .contact {
      padding-block: 6rem;
    }

    .section h2,
    .contact h2 {
      font-size: clamp(2.8rem, 14vw, 4.5rem);
    }

    .contact > .contact-title {
      font-size: clamp(2rem, 3.2vw, 3.5rem);
    }

    .work-item {
      min-height: auto;
      padding-block: 1.75rem;
    }

    .work-list {
      block-size: auto;
      flex-direction: column;
      overflow: visible;
    }

    .work-item {
      flex: none;
      padding-inline: 0;
    }

    .work-item:first-child {
      padding-block-start: 0;
    }

    .work-item:not(:first-child) {
      border-block-start: 1px solid var(--soft-line);
      border-inline-start: 0;
    }

    .experience-list li {
      padding-block: 1.75rem;
    }

    .experience-details {
      grid-template-columns: 1fr;
      gap: 0.25rem;
    }

    .experience-role,
    .experience-context,
    .experience-description,
    .experience-keywords {
      grid-column: 1;
      grid-row: auto;
    }

    .experience-role {
      min-height: 0;
      margin-block-start: 0.75rem;
    }

    .site-footer {
      min-height: 5rem;
    }
  }

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

    *,
    *::before,
    *::after {
      transition-duration: 0.01ms !important;
    }
  }

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