/* Kofee 接案工作室 */

:root {
  --bg: #f5f2ec;
  --surface: #fbfaf7;
  --ink: #1b1917;
  --muted: #5f5953;
  --line: #dcd6cb;
  --accent: #0b6b5e;
  --accent-ink: #ffffff;
  --accent-soft: #e2ede9;

  --font-display: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --font-body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --wrap: 1120px;
  --gutter: clamp(20px, 5vw, 48px);
  --section: clamp(72px, 11vw, 136px);
  --radius: 4px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151312;
    --surface: #1d1a18;
    --ink: #f1ede6;
    --muted: #a9a199;
    --line: #35302b;
    --accent: #5fcfb8;
    --accent-ink: #0c1513;
    --accent-soft: #1c2a27;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

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

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

a {
  color: inherit;
}

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

.wrap {
  width: min(100% - var(--gutter) * 2, var(--wrap));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  border-radius: var(--radius);
}

.skip:focus {
  top: 16px;
}

.mono {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  letter-spacing: 0;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease;
}

.site-header.is-stuck {
  border-bottom-color: var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  min-height: 44px;
  align-items: center;
}

.brand b {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.375rem;
  letter-spacing: 0.01em;
}

.brand span {
  font-size: 0.875rem;
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.9375rem;
  text-decoration: none;
  color: var(--muted);
  border-radius: var(--radius);
  transition: color 150ms ease;
}

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

.nav a.nav-cta {
  margin-left: 10px;
  padding: 0 18px;
  color: var(--accent-ink);
  background: var(--accent);
  font-weight: 500;
}

.nav a.nav-cta:hover {
  color: var(--accent-ink);
  filter: brightness(1.08);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.nav-toggle svg {
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

@media (max-width: 820px) {
  .nav-toggle {
    display: inline-block;
  }

  .nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }

  .nav.is-open {
    display: flex;
  }

  .nav a {
    min-height: 48px;
    padding: 0;
    font-size: 1rem;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
  }

  .nav a.nav-cta {
    margin: 16px 0 0;
    justify-content: center;
    border-bottom: 0;
    border-radius: var(--radius);
  }

  .brand span {
    display: none;
  }
}

/* ---------- Hero ---------- */

.hero {
  padding-top: clamp(56px, 10vw, 120px);
  padding-bottom: clamp(56px, 8vw, 96px);
}

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.875rem;
  color: var(--muted);
}

.eyebrow i {
  font-style: normal;
  color: var(--accent);
}

.hero h1 {
  margin-top: 22px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.875rem, 7.2vw, 5rem);
  line-height: 1.22;
  letter-spacing: -0.01em;
}

.hero h1 span {
  display: block;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-body {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(28px, 6vw, 80px);
  align-items: end;
  margin-top: clamp(32px, 5vw, 56px);
}

.hero-body p {
  max-width: 34em;
  color: var(--muted);
}

.hero-body p strong {
  color: var(--ink);
  font-weight: 500;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, filter 150ms ease;
}

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

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-ghost:hover {
  background: var(--ink);
  color: var(--bg);
}

@media (max-width: 760px) {
  .hero-body {
    grid-template-columns: 1fr;
    align-items: start;
  }

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

/* Stats */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(48px, 8vw, 88px);
  border-top: 1px solid var(--ink);
}

.stats div {
  padding: 22px 20px 0 0;
}

.stats div + div {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.stats dt {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 500;
  line-height: 1.1;
  font-feature-settings: "tnum";
}

.stats dt small {
  font-size: 0.5em;
  color: var(--accent);
  margin-left: 2px;
}

.stats dd {
  margin-top: 8px;
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 640px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats div {
    padding-bottom: 22px;
  }

  .stats div:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .stats div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

/* ---------- Sections ---------- */

.section {
  padding-block: var(--section);
  border-top: 1px solid var(--line);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 20px clamp(28px, 6vw, 80px);
  align-items: end;
  margin-bottom: clamp(36px, 6vw, 64px);
}

.section-head .label {
  display: block;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
}

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.75rem, 4.4vw, 2.75rem);
  line-height: 1.3;
}

.section-head p {
  color: var(--muted);
  max-width: 36em;
}

@media (max-width: 760px) {
  .section-head {
    grid-template-columns: 1fr;
  }
}

/* ---------- Services ---------- */

.services {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--line);
}

.services li {
  grid-column: span 2;
  padding: 28px 26px 32px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.services li:nth-child(n + 4) {
  grid-column: span 3;
}

.services .mono {
  font-size: 0.8125rem;
  color: var(--accent);
}

.services h3 {
  margin-top: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.45;
}

.services p {
  margin-top: 10px;
  font-size: 1rem;
  color: var(--muted);
}

.note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 28px;
  padding: 18px 22px;
  background: var(--accent-soft);
  border-radius: var(--radius);
}

.note a {
  color: var(--accent);
  font-weight: 500;
  text-underline-offset: 4px;
}

@media (max-width: 900px) {
  .services li,
  .services li:nth-child(n + 4) {
    grid-column: span 3;
  }

  .services li:last-child {
    grid-column: span 6;
  }
}

@media (max-width: 600px) {
  .services li,
  .services li:nth-child(n + 4),
  .services li:last-child {
    grid-column: span 6;
  }
}

/* ---------- Experience ledger ---------- */

.ledger {
  border-top: 1px solid var(--ink);
}

.ledger details {
  border-bottom: 1px solid var(--line);
}

.ledger summary {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto 28px;
  gap: 8px 20px;
  align-items: center;
  padding: 22px 0;
  cursor: pointer;
  list-style: none;
  transition: color 150ms ease;
}

.ledger summary::-webkit-details-marker {
  display: none;
}

.ledger summary:hover h3 {
  color: var(--accent);
}

.ledger .no {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--muted);
}

.ledger h3 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.6vw, 1.625rem);
  font-weight: 700;
  line-height: 1.4;
  transition: color 150ms ease;
}

.ledger .metric {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.ledger .chev {
  width: 20px;
  height: 20px;
  justify-self: end;
  color: var(--muted);
  transition: transform 200ms ease;
}

.ledger details[open] .chev {
  transform: rotate(45deg);
}

.ledger .body {
  padding: 0 48px 30px 76px;
}

.ledger .body ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 40px;
}

.ledger .body li {
  position: relative;
  padding-left: 18px;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.7;
}

.ledger .body li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.78em;
  width: 7px;
  height: 1px;
  background: var(--accent);
}

.ledger .body li b {
  color: var(--ink);
  font-weight: 500;
}

@media (max-width: 720px) {
  .ledger summary {
    grid-template-columns: 34px minmax(0, 1fr) 24px;
  }

  .ledger .metric {
    grid-column: 2 / 3;
    grid-row: 2;
    text-align: left;
    white-space: normal;
  }

  .ledger .chev {
    grid-column: 3;
    grid-row: 1;
  }

  .ledger .body {
    padding: 0 0 26px 54px;
  }

  .ledger .body ul {
    grid-template-columns: 1fr;
  }
}

/* ---------- Works ---------- */

.subhead {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: clamp(48px, 7vw, 80px) 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
}

.subhead:first-of-type {
  margin-top: 0;
}

.subhead h3 {
  font-size: 1.125rem;
  font-weight: 700;
}

.subhead span {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
}

.works {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.work {
  display: flex;
  flex-direction: column;
  padding: 24px 24px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.work.wide {
  grid-column: span 3;
}

.work.half {
  grid-column: span 3;
}

.work-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.status.is-early::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--muted);
}

.work h4 {
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.4;
}

.work h4 small {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--muted);
}

.work p {
  margin-top: 10px;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.75;
}

.tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 20px;
}

.tech li {
  padding: 3px 9px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 2px;
  white-space: nowrap;
}

.work.wide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 12px clamp(24px, 5vw, 56px);
  padding: clamp(24px, 4vw, 40px);
}

.work.wide h4 {
  font-size: clamp(1.5rem, 3.4vw, 2rem);
}

.work.wide .tech {
  margin-top: 0;
}

.series {
  counter-reset: g;
  border-top: 1px solid var(--line);
}

.series li {
  counter-increment: g;
  display: grid;
  grid-template-columns: 34px minmax(0, 9em) minmax(0, 1fr);
  gap: 4px 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.series li::before {
  content: "G" counter(g, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  padding-top: 3px;
}

.series b {
  font-weight: 500;
}

.series span {
  color: var(--muted);
}

@media (max-width: 960px) {
  .works {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .work.wide,
  .work.half {
    grid-column: span 2;
  }

  .work.wide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .works {
    grid-template-columns: 1fr;
  }

  .work.wide,
  .work.half {
    grid-column: span 1;
  }

  .series li {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .series span {
    grid-column: 2;
  }
}

@media (min-width: 961px) {
  .work.half {
    grid-column: auto;
  }
}

/* ---------- Stack ---------- */

.stack {
  border-top: 1px solid var(--ink);
}

.stack div {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 10px 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.stack dt {
  font-weight: 700;
}

.stack dd ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stack dd li {
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
}

.stack dd li.zh {
  font-family: var(--font-body);
}

@media (max-width: 640px) {
  .stack div {
    grid-template-columns: 1fr;
  }
}

/* ---------- Contact ---------- */

.contact {
  background: var(--ink);
  color: var(--bg);
  border-top: 0;
}

.contact .label {
  display: block;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: color-mix(in srgb, var(--bg) 62%, var(--ink));
}

.contact h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.25;
}

.contact > .wrap > p {
  margin-top: 20px;
  max-width: 34em;
  color: color-mix(in srgb, var(--bg) 72%, var(--ink));
}

.channels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: clamp(36px, 6vw, 64px);
}

.channels a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 26px 28px;
  text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--bg) 26%, var(--ink));
  border-radius: var(--radius);
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.channels a:hover {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--bg);
}

.channels small {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  opacity: 0.7;
}

.channels strong {
  font-family: var(--font-mono);
  font-size: clamp(1.125rem, 2.8vw, 1.625rem);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.channels span {
  font-size: 0.9375rem;
  opacity: 0.75;
}

@media (max-width: 640px) {
  .channels {
    grid-template-columns: 1fr;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--ink);
  color: color-mix(in srgb, var(--bg) 62%, var(--ink));
  font-size: 0.875rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 26px;
  border-top: 1px solid color-mix(in srgb, var(--bg) 18%, var(--ink));
}

/* ---------- Motion ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

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

  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

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

/* Two-column work grids */

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

@media (max-width: 620px) {
  .works.two {
    grid-template-columns: 1fr;
  }
}

/* Other personal projects: deliberately low-key */

.others {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px 20px;
  margin-top: clamp(36px, 5vw, 56px);
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--muted);
}

.others h3 {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.9;
}

.others ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
}

.others li {
  line-height: 1.9;
}

.others b {
  font-weight: 500;
  margin-right: 8px;
}

@media (max-width: 620px) {
  .others {
    grid-template-columns: 1fr;
  }

  .others li {
    width: 100%;
  }
}
