/* Sou Studio — Cake-like light portfolio
   Layout/feel inspired by Cake.me online portfolios:
   off-white canvas, 2-col 4:3 cards, title overlaid on cover.
   Accent stays Sou Studio blue. No Cake green / branding. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #1a1d24;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #5a9bfc;
  --accent-ink: #ffffff;
  --scrim: linear-gradient(to top, rgba(10, 13, 20, 0.72) 0%, rgba(10, 13, 20, 0.35) 45%, transparent 100%);
  --card-radius: 8px;
  --card-gap: 24px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
  --shadow-card-hover: 0 2px 4px rgba(16, 24, 40, 0.06), 0 12px 28px rgba(16, 24, 40, 0.1);
  --footer-bg: #12151c;

  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --step-lead: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);
  --step-head: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);

  --margin: clamp(1.25rem, 4vw, 4rem);
  --content: 1080px;
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --font-latin: "Switzer", "Noto Sans TC", system-ui, sans-serif;
  --font-cjk: "Noto Sans TC", "Switzer", system-ui, sans-serif;
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-cjk);
  font-size: var(--step-body);
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.75rem 1rem;
  z-index: 100;
}
.skip:focus { left: 1rem; top: 1rem; }

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.65rem 1.2rem;
  font-family: var(--font-cjk);
  font-size: var(--step-small);
  font-weight: 600;
  letter-spacing: -0.01em;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.35s var(--ease-spring), background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-accent:hover { background: #478ef5; color: var(--accent-ink); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  font-size: 0.85em;
  transition: transform 0.35s var(--ease-spring);
}
.btn-accent:hover .btn-icon { transform: translate(1px, -1px); }

/* —— Site header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 var(--margin);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.9);
}
.site-brand {
  font-family: var(--font-latin);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--ink);
}
.site-brand:hover { color: var(--ink); }
.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.site-nav a {
  font-size: var(--step-small);
  font-weight: 500;
  text-decoration: none;
  color: var(--muted);
}
.site-nav a:hover { color: var(--ink); }
.site-nav-cta {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink) !important;
  font-weight: 600 !important;
}
.site-nav-cta:hover { background: #478ef5; color: var(--accent-ink) !important; }

@media (max-width: 576px) {
  .site-nav { gap: 0.85rem; }
  .site-nav a:not(.site-nav-cta) { display: none; }
}

/* —— Hero —— */
.hero {
  padding: clamp(3.5rem, 10vh, 6.5rem) var(--margin) clamp(2.5rem, 6vh, 4rem);
}
.hero-inner {
  max-width: var(--content);
  margin: 0 auto;
}
.hero-kicker {
  margin: 0 0 0.75rem;
  font-family: var(--font-latin);
  font-size: var(--step-small);
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.hero-title {
  margin: 0 0 0.85rem;
  font-family: var(--font-latin);
  font-size: var(--step-head);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--ink);
}
.hero-lead {
  margin: 0 0 1.75rem;
  max-width: 28ch;
  font-size: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
  line-height: 1.45;
  color: var(--muted);
  font-weight: 400;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* —— Work grid —— */
.work {
  padding: 1rem var(--margin) clamp(3rem, 8vh, 5rem);
  max-width: calc(var(--content) + 2 * var(--margin));
  margin: 0 auto;
}
.work-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}
.work-title {
  margin: 0;
  font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
}
.work-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.work-filter {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  min-height: 36px;
  font-family: var(--font-cjk);
  font-size: var(--step-small);
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.work-filter:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
}
.work-filter.is-active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--card-gap);
}
.work-card.is-hidden { display: none; }

.work-card-link {
  display: block;
  height: 100%;
  text-decoration: none;
  color: inherit;
  border-radius: var(--card-radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.4s var(--ease-spring), box-shadow 0.4s var(--ease-spring);
}
.work-card-link:hover {
  text-decoration: none;
  color: inherit;
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.work-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #eef0f3;
  overflow: hidden;
}

/* Soft panel behind screenshot so raw UI feels framed */
.work-card-shot {
  position: absolute;
  inset: 10% 8% 22%;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
}
.work-card-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.work-card-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.work-card-scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48%;
  background: var(--scrim);
  pointer-events: none;
  z-index: 1;
}

.work-card-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 1rem 1.1rem 1.05rem;
  color: #fff;
  text-align: left;
}
.work-card-caption h3 {
  margin: 0;
  font-size: clamp(1rem, 0.92rem + 0.35vw, 1.1875rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.work-card-caption p {
  margin: 0.3rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.82);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 576px) {
  .work-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .work-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .work-card-shot {
    inset: 8% 6% 24%;
  }
}

/* —— About —— */
.about {
  padding: clamp(3rem, 8vh, 5rem) var(--margin);
  border-top: 1px solid var(--line);
}
.about-inner {
  max-width: var(--content);
  margin: 0 auto;
}
.about-title {
  margin: 0 0 1.25rem;
  font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.about-lead {
  margin: 0 0 2rem;
  max-width: 42ch;
  font-size: var(--step-lead);
  line-height: 1.55;
  color: var(--ink);
}
.about-facts {
  margin: 0 0 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
}
.about-facts dt {
  margin: 0;
  font-size: var(--step-small);
  color: var(--muted);
  font-weight: 400;
}
.about-facts dd {
  margin: 0.2rem 0 0;
  font-family: var(--font-latin);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}
.about-products {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2.5rem;
}
.about-products ul {
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 200px;
}
.about-products li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: var(--step-small);
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.about-products .yr {
  color: var(--muted);
  font-family: var(--font-latin);
}

/* —— CTA —— */
.cta {
  padding: 0 var(--margin) clamp(3rem, 8vh, 5rem);
}
.cta-card {
  max-width: var(--content);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 0;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
}
.cta-visual {
  background: #eef0f3;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.cta-visual img {
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: cover;
  object-position: top center;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.1);
}
.cta-copy {
  padding: clamp(1.75rem, 4vw, 2.5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.cta-line {
  margin: 0 0 0.75rem;
  font-size: clamp(1.375rem, 1.2rem + 0.7vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--ink);
}
.cta-support {
  margin: 0 0 0.65rem;
  font-size: var(--step-body);
  line-height: 1.55;
  color: var(--muted);
}
.cta-fact {
  margin: 0 0 1.35rem;
  font-family: var(--font-latin);
  font-size: var(--step-small);
  font-weight: 600;
  color: var(--ink);
}

@media (max-width: 720px) {
  .cta-card {
    grid-template-columns: 1fr;
  }
  .cta-visual {
    min-height: 200px;
    padding: 1.25rem;
  }
  .cta-copy .btn { width: 100%; }
}

/* —— Footer —— */
.footer {
  background: var(--footer-bg);
  color: #c5cbd6;
  padding: clamp(2.5rem, 6vh, 3.5rem) var(--margin) 1.75rem;
}
.footer-cols {
  max-width: var(--content);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem 1.25rem;
}
.footer-head {
  margin: 0 0 0.65rem;
  font-weight: 600;
  font-size: var(--step-small);
  color: #fff;
}
.footer-cols p {
  margin: 0 0 0.4rem;
  font-size: var(--step-small);
  color: #8b93a3;
}
.footer-cols a {
  color: #8b93a3;
  text-decoration: none;
}
.footer-cols a:hover { color: #fff; }
.footer-bottom {
  max-width: var(--content);
  margin: 2.5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid #2a2f3a;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}
.footer-mark {
  margin: 0;
  font-family: var(--font-latin);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}
.legal {
  margin: 0;
  font-size: 0.8125rem;
  color: #6b7382;
}

@media (max-width: 720px) {
  .footer-cols {
    grid-template-columns: 1fr 1fr;
    row-gap: 1.75rem;
  }
}

/* —— Reveals —— */
.js .reveal-child,
.js .work-card,
.js .cta-copy > * {
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity 0.7s var(--ease-spring), transform 0.7s var(--ease-spring);
}
.js .is-in.reveal-child,
.js .about-inner.is-in .reveal-child,
.js .work-card.is-in,
.js .cta-copy.is-in > * {
  opacity: 1;
  transform: none;
}
.js .about-inner .reveal-child:nth-child(1) { transition-delay: 0.05s; }
.js .about-inner .reveal-child:nth-child(2) { transition-delay: 0.12s; }
.js .about-inner .reveal-child:nth-child(3) { transition-delay: 0.18s; }
.js .about-inner .reveal-child:nth-child(4) { transition-delay: 0.24s; }
.js .cta-copy.is-in > *:nth-child(1) { transition-delay: 0.05s; }
.js .cta-copy.is-in > *:nth-child(2) { transition-delay: 0.1s; }
.js .cta-copy.is-in > *:nth-child(3) { transition-delay: 0.15s; }
.js .cta-copy.is-in > *:nth-child(4) { transition-delay: 0.2s; }
.js .work-card.is-in:nth-child(1) { transition-delay: 0.05s; }
.js .work-card.is-in:nth-child(2) { transition-delay: 0.12s; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal-child,
  .js .work-card,
  .js .cta-copy > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* —— Case study page (Cake-like anatomy, Sou blue accent) —— */
.page-case {
  background: #fff;
}
.page-case .site-header {
  background: rgba(255, 255, 255, 0.96);
}

.case {
  background: #fff;
  min-height: 50vh;
}
.case-loading,
.case-error {
  max-width: 920px;
  margin: 0 auto;
  padding: 4rem var(--margin);
  color: var(--muted);
}
.case-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.75rem var(--margin) clamp(3rem, 8vh, 5rem);
}

.case-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  margin: 0 0 1.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
}
.case-crumb a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.case-crumb a:hover { text-decoration: underline; }
.case-crumb-sep {
  color: #c5cad3;
  font-size: 0.75rem;
}
.case-crumb-current {
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-header {
  margin-bottom: 1.75rem;
}
.case-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.2;
  color: var(--ink);
}
.case-byline {
  margin: 0 0 0.85rem;
  font-size: var(--step-small);
  font-weight: 500;
  color: var(--ink);
}
.case-lead {
  margin: 0 0 0.65rem;
  max-width: 46ch;
  font-size: var(--step-body);
  line-height: 1.65;
  color: var(--muted);
}
.case-meta {
  margin: 0 0 1.35rem;
  font-family: var(--font-latin);
  font-size: 0.8125rem;
  color: #9ca3af;
}
.case-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.case-hero {
  margin: 0 0 2.75rem;
  border-radius: 12px;
  overflow: hidden;
  background: #eef0f3;
  box-shadow: var(--shadow-card);
}
.case-hero img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  object-position: top center;
  max-height: 520px;
}

.case-body {
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
}

.case-section-title {
  margin: 0 0 1rem;
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.35;
  color: var(--ink);
}
.case-section-body {
  color: #4b5563;
  font-size: var(--step-body);
  line-height: 1.75;
}
.case-section-body p {
  margin: 0 0 1rem;
}
.case-section-body p:last-child {
  margin-bottom: 0;
}
.case-bullets {
  margin: 0.85rem 0 0;
  padding: 0 0 0 1.25rem;
  color: #4b5563;
}
.case-bullets li {
  margin: 0.35rem 0;
  line-height: 1.6;
}

.case-figures {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: 12px;
  background: #f3f4f6;
  display: grid;
  gap: 1rem;
}
.case-figures--multi {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.case-figure {
  margin: 0;
}
.case-figure img {
  width: 100%;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
  object-fit: cover;
  object-position: top center;
  max-height: 360px;
}
.case-figure figcaption {
  margin-top: 0.55rem;
  font-size: 0.8125rem;
  color: #6b7280;
  text-align: center;
  line-height: 1.45;
}

.case-end-cta {
  margin-top: 3rem;
  padding: 2rem 1.5rem;
  border-radius: 12px;
  background: #f5f6f8;
  border: 1px solid var(--line);
  text-align: left;
}
.case-end-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.case-end-support {
  margin: 0 0 1.15rem;
  color: var(--muted);
  font-size: var(--step-body);
  line-height: 1.55;
  max-width: 42ch;
}

@media (max-width: 640px) {
  .case-figures--multi {
    grid-template-columns: 1fr;
  }
  .case-hero img {
    max-height: 280px;
  }
  .case-actions .btn {
    flex: 1 1 auto;
  }
  .case-crumb-current {
    white-space: normal;
  }
}
