/* =============================================================
   Playwithspect — Works (Portfolio) styles
   Shares the box's design language: yellow / cyan / ink, fat ink
   borders, rounded cards, Mabook display font. Loads on /work/ and
   is written so /edu/ can reuse the same tokens + primitives.
   ============================================================= */

/* ---------- Display font (same file the 3D box uses for signs) ---------- */
@font-face {
  font-family: "Mabook";
  src: url("../../asset/Mabook.ttf") format("truetype");
  font-display: swap;
}

:root {
  --pws-yellow: #ffcc00;
  --pws-cyan: #00c1ff;
  --pws-pink: #ff6fb5;
  --ink: #1a1a1a;
  --paper: #ffcc00;          /* signature yellow — the page background */
  --muted: #6b6b6b;
  --card-radius: 22px;
  --border: 4px solid var(--ink);
  --shadow-hard: 8px 8px 0 var(--ink);
  --accent: var(--pws-cyan); /* overridden per-category / per-project */
  --display: "Mabook", "Inter", system-ui, sans-serif;
  --body: "Inter", "Helvetica Neue", Arial, "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-height: 100%;
  font-family: var(--body);
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(26, 26, 26, 0.06) 1px, transparent 0);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; }

/* ---------- Entry curtain (continuity from the box hole) ---------- */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  transform-origin: top;
  pointer-events: none;
}
body:not(.curtain-up) .curtain { pointer-events: auto; }

/* ---------- Top bar ---------- */
.work-top {
  /* Static header — sits at the top of the page and scrolls away with the
     content (does not follow the scroll). Just the "back to the box" button. */
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 48px) 0;
}

.work-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  text-decoration: none;
  padding: 8px 14px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff;        /* white pill — stands out on the yellow page */
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.work-back:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.work-back:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }

.work-cats {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}
.work-cat {
  font-weight: 800;
  font-size: 0.95rem;
  text-decoration: none;
  padding: 8px 16px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  transition: transform 0.15s ease, background 0.15s ease;
}
.work-cat:hover { transform: translateY(-2px); }
.work-cat[aria-current="true"] {
  background: var(--accent);
  box-shadow: 3px 3px 0 var(--ink);
}

/* ---------- Hero ---------- */
.work-hero {
  text-align: center;
  padding: clamp(48px, 9vw, 110px) clamp(16px, 5vw, 48px) clamp(28px, 5vw, 56px);
  position: relative;
}
.work-hero__eyebrow {
  display: inline-block;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.8rem;
  padding: 6px 14px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  margin-bottom: 18px;
}
.work-hero__title {
  font-family: var(--display);
  font-size: clamp(2.8rem, 11vw, 7rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-shadow: 5px 5px 0 var(--accent), 5px 5px 0 var(--ink);
}
.work-hero__sub {
  max-width: 620px;
  margin: 22px auto 0;
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  color: var(--muted);
}

/* ---------- Project grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: clamp(20px, 3vw, 34px);
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px clamp(16px, 5vw, 48px) clamp(60px, 10vw, 130px);
}

.card {
  --accent: var(--pws-cyan);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  text-align: left;
  background: #fff;
  border: var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-hard);
  transition: transform 0.2s cubic-bezier(.2,.8,.2,1), box-shadow 0.2s ease;
  will-change: transform;
}
.card:hover {
  transform: translate(-4px, -4px) rotate(-0.6deg);
  box-shadow: 12px 12px 0 var(--ink);
}
.card:active { transform: translate(0, 0); box-shadow: 4px 4px 0 var(--ink); }

.card__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--accent);
  background-image:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 85%, #fff), color-mix(in srgb, var(--accent) 55%, var(--ink)));
  border-bottom: var(--border);
  overflow: hidden;
}
.card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__thumb::after {
  /* playful diagonal sheen */
  content: "";
  position: absolute;
  inset: -40% -10%;
  background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,0.35) 50%, transparent 60%);
  transform: translateX(-30%);
  transition: transform 0.6s ease;
}
.card:hover .card__thumb::after { transform: translateX(30%); }

.card__play {
  position: absolute;
  left: 14px;
  bottom: 14px;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  border: 2px solid #fff;
}

.card__body { display: block; padding: 18px 20px 22px; }
.card__cat {
  display: block;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 55%, var(--ink));
}
.card__title {
  display: block;
  font-family: var(--display);
  font-size: 1.6rem;
  line-height: 1.05;
  margin: 6px 0 8px;
}
.card__tagline { display: block; color: var(--muted); font-size: 0.95rem; line-height: 1.4; }

/* ---------- Flip clone (the thumbnail that grows into the detail) ---------- */
.flip-clone {
  position: fixed;
  z-index: 150;
  border-radius: var(--card-radius);
  border: var(--border);
  overflow: hidden;
  pointer-events: none;
}
.flip-clone img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Detail view ---------- */
.detail {
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, rgba(26,26,26,0.06) 1px, transparent 0);
  background-size: 22px 22px;
}
.detail[hidden] { display: none; }

.detail__close {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 4;
  width: 50px;
  height: 50px;
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #fff;        /* white on the yellow page */
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.15s ease;
}
.detail__close:hover { transform: rotate(90deg) scale(1.05); }

.detail__inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(60px, 8vw, 90px) clamp(16px, 5vw, 40px) 120px;
  opacity: 1; /* resting state — content is visible even if JS never runs */
}
.detail__inner.is-entering { animation: detail-in 0.45s ease both; }
@keyframes detail-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .detail__inner.is-entering { animation: none; }
}

.detail__head { margin-bottom: 26px; }
.detail__cat {
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: color-mix(in srgb, var(--accent) 55%, var(--ink));
}
.detail__title {
  font-family: var(--display);
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  line-height: 0.98;
  margin: 6px 0 10px;
}
.detail__tagline { font-size: clamp(1.05rem, 2.6vw, 1.35rem); color: var(--muted); max-width: 640px; }

/* Showcase — the arcade cabinet / embed frame */
.showcase {
  position: relative;
  margin: 8px 0 40px;
  border: var(--border);
  border-radius: var(--card-radius);
  background: var(--ink);
  box-shadow: var(--shadow-hard);
  overflow: hidden;
}
.showcase__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--accent);
  border-bottom: var(--border);
}
.showcase__dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; }
.showcase__label { margin-left: auto; font-weight: 800; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.showcase__open {
  font-weight: 800;
  font-size: 0.78rem;
  text-decoration: none;
  color: var(--ink);
  padding: 4px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
}
.showcase__open:hover { background: var(--ink); color: #fff; }
.showcase__frame {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #000;
}
.showcase__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }

/* Download-only title art */
.showcase__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.showcase__cta {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  font-weight: 800;
  text-decoration: none;
  color: var(--ink);
  padding: 12px 22px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--pws-yellow);
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.showcase__cta:hover { transform: translateX(-50%) translateY(-2px); box-shadow: 4px 7px 0 var(--ink); }

/* Placeholder when no build/embed is wired yet */
.showcase__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #fff;
  text-align: center;
  padding: 24px;
  background:
    radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--accent) 45%, #000), #000 70%);
}
.showcase__placeholder .ph-badge {
  font-size: 2.6rem;
  width: 84px; height: 84px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 3px solid #fff;
  animation: ph-pulse 2.2s ease-in-out infinite;
}
.showcase__placeholder p { font-weight: 700; opacity: 0.9; }
.showcase__placeholder small { opacity: 0.6; }
@keyframes ph-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 16px transparent; }
}

/* Columns: devlog + meta sidebar */
.detail__cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
}
@media (min-width: 780px) {
  .detail__cols { grid-template-columns: 1fr 280px; align-items: start; }
}

.devlog h2 {
  font-family: var(--display);
  font-size: 1.9rem;
  margin: 0 0 6px;
}
.devlog__entry { margin-bottom: 30px; }
.devlog__entry h3 {
  font-size: 1.25rem;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
}
.devlog__entry h3::before {
  content: "";
  width: 14px; height: 14px;
  background: var(--accent);
  border: 2px solid var(--ink);
  border-radius: 4px;
  transform: rotate(45deg);
  flex: none;
}
.devlog__entry p { line-height: 1.7; margin-bottom: 12px; color: #2b2b2b; }
.devlog__entry strong { background: color-mix(in srgb, var(--accent) 40%, #fff); padding: 0 3px; }

.meta-card {
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fff;
  padding: 20px;
  box-shadow: 5px 5px 0 var(--ink);
  position: sticky;
  top: 90px;
}
.meta-card h4 { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.meta-card .meta-row { margin-bottom: 14px; }
.meta-card .meta-row p { font-weight: 700; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 0.78rem; font-weight: 700;
  padding: 4px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, #fff);
}

/* BTS gallery */
.gallery { margin-top: 50px; }
.gallery h2 { font-family: var(--display); font-size: 1.9rem; margin-bottom: 16px; }
.gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.gallery__item {
  aspect-ratio: 4 / 3;
  border: 3px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 30%, #fff), color-mix(in srgb, var(--accent) 12%, #fff));
  display: grid; place-items: center;
  color: color-mix(in srgb, var(--accent) 65%, var(--ink));
  font-weight: 800;
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px 120px;
  font-weight: 700;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .card, .card__thumb::after { transition: none; }
  .showcase__placeholder .ph-badge { animation: none; }
}

/* No-JS fallback list is plain but readable */
.nojs-list a { font-weight: 700; }
