/* === shumer.dev CSS === */

/* Color scheme */
:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #5a5a5a;
  --muted2: #8a8a8a;
  --border: #111111;
  --max: 800px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --fg: #f5f5f7;
    --muted: #b8b8b8;
    --muted2: #909090;
    --border: #f2f2f2;
  }
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Core typography & layout */
body {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.75;
  color: var(--fg);
  background: var(--bg);
  max-width: var(--max);
  margin: 0 auto;
  padding: 56px 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings */
h1 {
  font-size: 20px;
  letter-spacing: 0.4px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
  line-height: 1.3;
}

h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.25px;
  margin-bottom: 6px;
}

/* Links */
a {
  color: inherit;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  padding-bottom: 1px;
  transition: background 0.15s ease, color 0.15s ease;
  opacity: 0.9;
}

a:hover {
  color: var(--bg);
  background: var(--fg);
  opacity: 1;
}

a:focus-visible {
  outline: 2px dashed var(--fg);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

/* Paragraphs */
p {
  color: var(--muted);
  margin-bottom: 10px;
}

/* Spacing utilities */
.stack > * + * { margin-top: 40px; }
.stack-sm > * + * { margin-top: 18px; }
.stack-xs > * + * { margin-top: 10px; }

/* Indentation */
.indent { padding-left: 24px; }
.double-indent { padding-left: 48px; }
.triple-indent { padding-left: 72px; }

/* Category label */
.cat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted2);
  margin-bottom: 8px;
}

/* Back link */
.back-link {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
  background-image: none;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--fg);
  background: none;
}

/* Site header */
.site-header {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 14px 0 10px;
  z-index: 10;
}

.site-header h1 {
  margin-bottom: 6px;
}

/* Instagram line under the site title */
.site-ig {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.3px;
  color: var(--muted2);
}

.site-ig a {
  color: var(--muted2);
  opacity: 0.9;
}

.site-ig a:hover {
  color: var(--bg);
  background: var(--fg);
}

/* Header cover banner */
.site-banner {
  margin: 0 0 22px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.site-banner img {
  display: block;
  width: 100%;
  height: clamp(150px, 30vw, 280px);
  object-fit: cover;
  object-position: center 38%;
}

@media (prefers-color-scheme: dark) {
  .site-banner { border-color: rgba(255, 255, 255, 0.12); }
}

@media (max-width: 520px) {
  .site-banner img { height: clamp(130px, 42vw, 200px); }
}

/* Section nav */
.section-nav {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.section-nav a {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted2);
  background-image: none;
  padding: 0;
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.section-nav a:hover {
  color: var(--fg);
  background: none;
  border-bottom-color: var(--fg);
}

.section-nav a.active {
  color: var(--fg);
  border-bottom-color: var(--fg);
}

.section-nav .sep {
  color: var(--muted2);
  font-size: 11px;
  user-select: none;
}

/* Card grid for index page */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 28px;
  margin-top: 28px;
}

.card {
  display: block;
  background-image: none;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 80ms ease, box-shadow 0.15s ease;
}

.card:hover {
  background: none;
  border-color: var(--fg);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  color: inherit;
}

.card-media {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.card-label {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

/* Placeholder card (no cover yet) */
.card.placeholder {
  display: flex;
  align-items: center;
  min-height: 92px;
  border-style: dashed;
}

.card.placeholder .card-label::before {
  content: "（待補）";
  display: block;
  color: var(--muted2);
  font-size: 11px;
  margin-bottom: 4px;
}

/* Detail page media */
.detail-media {
  width: 100%;
  max-width: 100%;
  border-radius: 4px;
  margin: 16px 0;
}

/* Description text */
#desc {
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.75;
}

/* Dark mode card adjustments */
@media (prefers-color-scheme: dark) {
  .card {
    border-color: rgba(255, 255, 255, 0.1);
  }

  .card-media {
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }

  .card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

/* Responsive */
@media (max-width: 520px) {
  body {
    font-size: 13px;
    padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(36px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .card-label {
    padding: 12px 16px;
    font-size: 13px;
  }

  .detail-media {
    border-radius: 2px;
  }
}

/* Print */
@media print {
  body { max-width: 100%; padding: 20px; }
  a { background-image: none; }
  a::after { content: " (" attr(href) ")"; font-size: 10px; color: var(--muted2); }
}

/* ============================================================
   MOTION VIEW  —  outpace-studios style scroll choreography
   Active only when <html class="motion"> (set by motion.js).
   The static (original) look is the default and untouched.
   ============================================================ */

:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --reveal-dur: 0.9s;
}

/* --- hidden / pre-reveal states (only in motion mode) --- */

.motion .site-header,
.motion h2,
.motion .cat-label,
.motion .back-link,
.motion #desc {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity var(--reveal-dur) var(--ease-out),
    transform var(--reveal-dur) var(--ease-out);
}

.motion .site-header {
  transform: translateY(-14px);
  will-change: opacity, transform;
}

/* horizontal rules wipe open from the left */
.motion hr {
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.9s var(--ease-out);
}

/* cards rise + fade, staggered, with an image that settles from a zoom */
.motion .card {
  opacity: 0;
  transform: translateY(34px);
  transition:
    opacity var(--reveal-dur) var(--ease-out),
    transform var(--reveal-dur) var(--ease-out),
    border-color 0.15s ease,
    box-shadow 0.2s ease;
  transition-delay: calc(var(--i, 0) * 70ms);
  will-change: opacity, transform;
}

.motion .card .card-media {
  transform: scale(1.14);
  transition: transform 1.2s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}

/* category index rows */
.motion .cat-index li {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.7s var(--ease-out),
    transform 0.7s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 55ms);
}

/* header cover banner: mask wipe + settle from a zoom */
.motion .site-banner {
  opacity: 0;
  clip-path: inset(0 0 100% 0);
  transition:
    opacity 1s var(--ease-out),
    clip-path 1.1s var(--ease-out);
}

.motion .site-banner img {
  transform: scale(1.08);
  transition: transform 1.3s var(--ease-out);
}

.motion .site-banner.in-view {
  opacity: 1;
  clip-path: inset(0 0 0 0);
}

.motion .site-banner.in-view img {
  transform: scale(1);
}

/* detail page hero image: reveal via a vertical mask wipe + zoom */
.motion .detail-media {
  opacity: 0;
  clip-path: inset(0 0 100% 0);
  transform: scale(1.06);
  transition:
    opacity 1s var(--ease-out),
    clip-path 1.1s var(--ease-out),
    transform 1.2s var(--ease-out);
}

/* --- revealed states --- */

.motion .site-header.in-view,
.motion h2.in-view,
.motion .cat-label.in-view,
.motion .back-link.in-view,
.motion #desc.in-view,
.motion .card.in-view {
  opacity: 1;
  transform: none;
}

.motion hr.in-view {
  transform: scaleX(1);
}

.motion .card.in-view .card-media {
  transform: scale(1);
}

.motion .cat-index li.in-view {
  opacity: 1;
  transform: none;
}

.motion .detail-media.in-view {
  opacity: 1;
  clip-path: inset(0 0 0 0);
  transform: scale(1);
}

/* hover: gentle parallax zoom inside the card frame (motion mode only) */
.motion .card:hover .card-media {
  transform: scale(1.05);
}

/* ============================================================
   VIEW TOGGLE BUTTON  (injected by motion.js, present in both modes)
   ============================================================ */

.view-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
  -webkit-font-smoothing: antialiased;
}

.view-toggle:hover {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.view-toggle:focus-visible {
  outline: 2px dashed var(--fg);
  outline-offset: 3px;
}

.view-toggle .vt-label {
  color: var(--muted2);
}

.view-toggle .vt-state {
  font-weight: 600;
  min-width: 46px;
  text-align: left;
}

.view-toggle .vt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted2);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.view-toggle.is-motion .vt-dot {
  background: #2bd66a;
  box-shadow: 0 0 0 3px rgba(43, 214, 106, 0.18);
  animation: vt-pulse 1.6s ease-in-out infinite;
}

@keyframes vt-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(43, 214, 106, 0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(43, 214, 106, 0.05); }
}

/* "Show everything on one page" button (injected by motion.js) */
.all-works-btn {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  background-image: none;
  opacity: 0.85;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
  -webkit-font-smoothing: antialiased;
}

.all-works-btn:hover {
  opacity: 1;
  color: var(--fg);
  background: var(--bg);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.all-works-btn:focus-visible {
  outline: 2px dashed var(--fg);
  outline-offset: 3px;
}

/* small grid glyph */
.all-works-btn .aw-icon {
  width: 11px;
  height: 11px;
  flex: none;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 4px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 100% 0 / 4px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 0 100% / 4px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 100% 100% / 4px 4px no-repeat;
  opacity: 0.85;
}

@media print {
  .view-toggle,
  .all-works-btn { display: none; }
}

/* Bigger, easier-to-tap controls on small screens */
@media (max-width: 520px) {
  .all-works-btn {
    left: max(14px, env(safe-area-inset-left));
    bottom: max(14px, env(safe-area-inset-bottom));
    gap: 9px;
    padding: 13px 16px;
    font-size: 12px;
    opacity: 0.95;
  }
}

/* On phones motion is always on, so the Static/Motion toggle is hidden */
@media (max-width: 520px) {
  .view-toggle {
    display: none;
  }
}

/* Accessibility: honour reduced-motion even if motion view is chosen —
   show everything, drop the movement. */
@media (prefers-reduced-motion: reduce) {
  .motion .site-banner,
  .motion .site-banner img,
  .motion .site-header,
  .motion h2,
  .motion .cat-label,
  .motion .back-link,
  .motion #desc,
  .motion hr,
  .motion .card,
  .motion .card .card-media,
  .motion .cat-index li,
  .motion .detail-media {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    transition: none !important;
  }
  .view-toggle.is-motion .vt-dot { animation: none; }
}

/* Stronger, more noticeable entrance on phones (motion is always on there) */
@media (max-width: 520px) and (prefers-reduced-motion: no-preference) {
  :root { --reveal-dur: 1s; }

  .motion .card {
    transform: translateY(56px) scale(0.96);
    transition-delay: calc(var(--i, 0) * 90ms);
  }
  .motion .card.in-view {
    transform: none;
  }
  .motion .card .card-media {
    transform: scale(1.2);
    transition-duration: 1.4s;
    transition-delay: calc(var(--i, 0) * 90ms);
  }

  .motion h2,
  .motion #desc,
  .motion .cat-label {
    transform: translateY(40px);
  }

  .motion .cat-index li {
    transform: translateY(28px);
    transition-delay: calc(var(--i, 0) * 75ms);
  }

  .motion .detail-media,
  .motion .site-banner img {
    transform: scale(1.12);
  }
}
