@layer reset, base, theme, layout, components;

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

  html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-h, 72px);
  }

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

    *,
    *::before,
    *::after {
      animation: none !important;
      transition: none !important;
    }
  }

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

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

  img,
  svg {
    display: block;
    max-width: 100%;
  }

  button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
  }

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

@layer theme {
  :root {
    --clay: #a84c32;
    --clay-dark: #8d3d27;
    --ink: #1b1b1b;
    --muted: #6a6560;
    --line: #e7e2dc;
    --paper: #f7f5f2;
    --white: #ffffff;
    --footer: #1c1c1c;
    --radius: 2px;
    --header-h: 72px;
    --display: "Noto Serif SC", "Songti SC", serif;
    --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    --space: clamp(1.25rem, 4vw, 2.5rem);
    --max: 1120px;
  }
}

@layer base {
  body {
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--ink);
    background: var(--white);
    text-wrap: pretty;
  }

  h1,
  h2,
  h3,
  .logo {
    font-family: var(--display);
    font-weight: 700;
    line-height: 1.2;
    text-wrap: balance;
  }

  :focus-visible {
    outline: 2px solid var(--clay);
    outline-offset: 3px;
  }

  .skip-link {
    position: absolute;
    inset-inline-start: 1rem;
    top: -4rem;
    z-index: 20;
    padding: 0.5rem 0.8rem;
    background: var(--ink);
    color: var(--white);
  }

  .skip-link:focus {
    top: 0.75rem;
  }
}

@layer layout {
  .shell {
    width: min(calc(100% - 2.5rem), var(--max));
    margin-inline: auto;
  }

  .section-title {
    margin-block-end: 2.5rem;
    font-size: clamp(1.6rem, 3vw, 2rem);
    text-align: center;
  }
}

@layer components {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--white) 92%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
  }

  @supports (animation-timeline: scroll()) {
    .site-header {
      border-bottom-color: color-mix(in srgb, var(--line) 0%, transparent);
      animation: header-line linear both;
      animation-timeline: scroll();
      animation-range: 0 80px;
    }

    @keyframes header-line {
      to {
        border-bottom-color: var(--line);
        background: color-mix(in srgb, var(--white) 96%, transparent);
      }
    }
  }

  .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-h);
    gap: 1rem;
  }

  .logo {
    font-size: 1.35rem;
    letter-spacing: 0.04em;
  }

  .nav {
    display: flex;
    gap: 1.75rem;
    font-size: 0.92rem;
  }

  .nav a {
    color: #3d3d3d;
  }

  .nav a:hover {
    color: var(--clay);
  }

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

  .menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    place-items: center;
    gap: 5px;
  }

  .menu-toggle span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: var(--ink);
  }

  .mobile-nav {
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 1.25rem 1.25rem;
    background: var(--white);
    border-bottom: 1px solid var(--line);
  }

  .mobile-nav a {
    min-height: 44px;
    display: grid;
    align-items: center;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.55rem 1.25rem;
    border: 1px solid var(--clay);
    border-radius: var(--radius);
    font-size: 0.92rem;
    letter-spacing: 0.04em;
    transition: background 0.2s, color 0.2s;
  }

  .btn-solid {
    background: var(--clay);
    color: var(--white);
  }

  .btn-solid:hover {
    background: var(--clay-dark);
  }

  .btn-outline,
  .btn-ghost {
    background: transparent;
    color: var(--clay);
  }

  .btn-ghost {
    color: var(--ink);
    border-color: #cfc8c1;
  }

  .btn-outline:hover,
  .btn-ghost:hover {
    background: var(--paper);
  }

  .btn-light {
    background: var(--white);
    color: var(--clay);
    border-color: var(--white);
  }

  .btn-light:hover {
    background: var(--paper);
  }

  .hero {
    padding-block: clamp(3rem, 8vw, 6rem);
  }

  .hero-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 4rem;
    align-items: center;
  }

  .hero-copy h1 {
    font-size: clamp(2.2rem, 4.6vw, 3.4rem);
    letter-spacing: 0.02em;
  }

  .hero-copy p {
    max-width: 34em;
    margin-block: 1.25rem 2rem;
    color: var(--muted);
  }

  .hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .hero-art {
    position: relative;
    aspect-ratio: 1;
    background:
      linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 40px 40px,
      linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 40px 40px,
      #f3f1ee;
    overflow: hidden;
  }

  .art-letter,
  .art-han,
  .art-block,
  .art-bar,
  .art-word {
    position: absolute;
  }

  .art-letter {
    inset: 12% auto auto 10%;
    font-family: var(--display);
    font-size: clamp(6rem, 14vw, 10rem);
    line-height: 0.8;
    color: #c9c3bb;
  }

  .art-han {
    inset: auto 14% 18% auto;
    font-family: var(--display);
    font-size: clamp(4rem, 9vw, 6.5rem);
    color: var(--ink);
  }

  .art-block {
    inset: 22% auto auto 48%;
    width: 22%;
    aspect-ratio: 1;
    background: var(--clay);
  }

  .art-bar {
    inset: auto auto 28% 12%;
    width: 34%;
    height: 10px;
    background: #d7d1ca;
  }

  .art-word {
    inset: 18% 12% auto auto;
    font-size: 0.72rem;
    letter-spacing: 0.4em;
    color: #8d8680;
  }

  .trust {
    background: var(--paper);
    padding-block: 1.75rem;
  }

  .trust-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }

  .trust-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--clay);
    font-size: 0.95rem;
  }

  .trust-item svg {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  .about {
    padding-block: clamp(3.5rem, 8vw, 6rem);
  }

  .about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
  }

  .about-visual {
    min-height: 360px;
    background: #ece7e1;
    overflow: hidden;
  }

  .desk {
    position: relative;
    height: 100%;
    min-height: 360px;
    background:
      linear-gradient(#ddd6ce, #ddd6ce) 0 0 / 100% 62%,
      linear-gradient(#cfc6bb, #cfc6bb);
  }

  .desk-wall {
    position: absolute;
    inset: 12% 12% auto 12%;
    display: flex;
    gap: 12px;
    height: 42%;
  }

  .poster {
    flex: 1;
    background: var(--white);
    box-shadow: 0 8px 18px rgb(0 0 0 / 8%);
  }

  .p1 { background: linear-gradient(#efe8e0, #d9d0c6); }
  .p2 { background: linear-gradient(#b24a34, #8d3d27); }
  .p3 { background: linear-gradient(#f7f3ee, #e4ddd4); }

  .lamp {
    position: absolute;
    left: 14%;
    bottom: 18%;
    width: 70px;
    height: 90px;
    background:
      radial-gradient(circle at 50% 18%, #2a2a2a 10px, transparent 11px),
      linear-gradient(#2a2a2a, #2a2a2a) 32px 18px / 6px 50px no-repeat,
      linear-gradient(#2a2a2a, #2a2a2a) 18px 66px / 34px 6px no-repeat;
  }

  .book-stack {
    position: absolute;
    right: 18%;
    bottom: 16%;
    display: grid;
    gap: 4px;
    width: 110px;
  }

  .book-stack span {
    height: 14px;
    background: #8d3d27;
  }

  .book-stack span:nth-child(2) { background: #c9b8a6; }
  .book-stack span:nth-child(3) { background: #4a433c; width: 88%; }

  .notebook {
    position: absolute;
    left: 38%;
    bottom: 14%;
    width: 92px;
    height: 68px;
    padding: 10px 8px;
    background: var(--white);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    line-height: 1.3;
    color: #7a736c;
  }

  .about-copy h2 {
    margin-block-end: 1.1rem;
    font-size: clamp(1.7rem, 3vw, 2.1rem);
  }

  .about-copy p {
    color: var(--muted);
  }

  .about-meta {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
    font-size: 0.92rem;
  }

  .services {
    background: var(--paper);
    padding-block: clamp(3.5rem, 8vw, 6rem);
  }

  .service-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
  }

  .service-card {
    padding: 1.6rem 1.3rem 1.4rem;
    background: var(--white);
  }

  .service-card svg {
    width: 36px;
    height: 36px;
    margin-block-end: 1.1rem;
    color: var(--clay);
  }

  .service-card h3 {
    margin-block-end: 0.55rem;
    font-size: 1.05rem;
  }

  .service-card p {
    color: var(--muted);
    font-size: 0.9rem;
  }

  .works {
    padding-block: clamp(3.5rem, 8vw, 6rem);
  }

  .works .section-title {
    margin-block-end: 0.55rem;
  }

  .section-note {
    margin-block-end: 2.5rem;
    color: var(--muted);
    font-size: 0.88rem;
    text-align: center;
  }

  .work-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }

  .work-card {
    position: relative;
    overflow: hidden;
    background: #ece8e3;
  }

  .work-art {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.45s ease;
  }

  .work-card:hover .work-art {
    transform: scale(1.035);
  }

  .work-tag {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 1;
    padding: 0.2rem 0.55rem;
    background: rgb(255 255 255 / 88%);
    font-size: 0.75rem;
  }

  .process {
    background: var(--paper);
    padding-block: clamp(3.5rem, 8vw, 6rem);
  }

  .process-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
  }

  .process-row li {
    position: relative;
    padding-inline-end: 1rem;
  }

  .process-row li:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 0.7rem;
    inset-inline-end: -0.4rem;
    width: 1.4rem;
    height: 1px;
    background: #cfc8c1;
  }

  .process-row span {
    display: block;
    margin-block-end: 0.6rem;
    color: var(--clay);
    font-family: var(--display);
    font-size: 1.2rem;
  }

  .process-row h3 {
    margin-block-end: 0.4rem;
    font-size: 1.05rem;
  }

  .process-row p {
    color: var(--muted);
    font-size: 0.9rem;
  }

  .contact {
    padding-block: clamp(3.5rem, 8vw, 5.5rem);
    background:
      radial-gradient(circle at 20% 20%, rgb(255 255 255 / 8%), transparent 32%),
      var(--clay);
    color: var(--white);
    text-align: center;
  }

  .contact h2 {
    margin-block-end: 0.7rem;
    font-size: clamp(1.6rem, 3vw, 2.1rem);
  }

  .contact > .shell > p,
  .contact-inner > p {
    opacity: 0.88;
  }

  .contact-list {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-block: 1.8rem 1.6rem;
  }

  .contact-list dt {
    font-size: 0.78rem;
    opacity: 0.75;
  }

  .contact-list dd {
    font-size: 1.05rem;
  }

  .contact-list a {
    color: inherit;
  }

  .site-footer {
    padding-block: 2.2rem 2rem;
    background: var(--footer);
    color: #cfc8c1;
    font-size: 0.82rem;
    line-height: 1.8;
  }

  .footer-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: start;
  }

  .footer-name {
    margin-block-end: 0.4rem;
    color: var(--white);
  }

  .footer-links {
    display: flex;
    gap: 1.2rem;
  }

  .footer-links a:hover {
    color: var(--white);
  }

  .legal-page {
    padding-block: 5rem 4rem;
  }

  .legal-page h1 {
    margin-block-end: 1.25rem;
    font-size: 1.8rem;
  }

  .legal-page p,
  .legal-page li {
    margin-block-end: 0.9rem;
    color: var(--muted);
  }

  .legal-page ul {
    padding-inline-start: 1.2rem;
    list-style: disc;
  }

  @media (max-width: 960px) {
    .hero-grid,
    .about-grid,
    .service-grid,
    .work-grid,
    .process-row,
    .footer-grid {
      grid-template-columns: 1fr 1fr;
    }

    .nav,
    .header-cta {
      display: none;
    }

    .menu-toggle {
      display: grid;
    }

    .mobile-nav:not([hidden]) {
      display: flex;
    }

    .process-row li:not(:last-child)::after {
      display: none;
    }
  }

  @media (max-width: 720px) {
    .hero-grid,
    .about-grid,
    .service-grid,
    .work-grid,
    .trust-row,
    .process-row,
    .footer-grid,
    .contact-list {
      grid-template-columns: 1fr;
    }

    .contact-list {
      display: grid;
      gap: 1rem;
    }

    .hero-art {
      max-width: 360px;
    }
  }
}
