/* Ink & Pixels — sections  (governed by DESIGN.md) */

.section {
  position: relative; z-index: 1;
  max-width: 1180px; margin: 0 auto;
  padding: var(--space-24) clamp(var(--space-4), 5vw, var(--space-24)) var(--space-12);
}
.section + .section, .duality { border-top: var(--border-w) solid var(--stroke); }

/* shared section head */
.sec-head { margin-bottom: var(--space-12); position: relative; }
.kicker {
  font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: .08em;
  color: var(--accent-text); display: block; margin-bottom: var(--space-3);
}
.sec-title {
  font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em;
  font-size: var(--text-2xl); line-height: 1.04; max-width: 18ch;
}
.hl-pixels, .hl-ink { color: var(--ink); padding: 0 .1em;
  box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.hl-pixels { background: var(--pixels); }
.hl-ink { background: var(--expression); }

/* generic chunky tag */
.tag {
  font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .02em;
  padding: 3px var(--space-2); background: var(--surface);
  border: 2px solid var(--stroke); white-space: nowrap;
}
.tag-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ---------- 01 DUALITY ---------- */
.flip {
  position: absolute; top: 0; right: 0;
  font-family: var(--font-mono); font-size: var(--text-sm); cursor: pointer;
  padding: var(--space-3) var(--space-4); background: var(--surface); color: var(--text);
  border: var(--border-w) solid var(--stroke); box-shadow: var(--shadow);
  transition: transform var(--t-micro) var(--ease-out), box-shadow var(--t-micro) var(--ease-out);
}
.flip:hover { transform: translate(-3px,-3px); box-shadow: var(--shadow-hover); }
.flip:active { transform: translate(4px,4px); box-shadow: var(--shadow-press); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
.half {
  background: var(--surface); border: var(--border-w) solid var(--stroke); box-shadow: var(--shadow);
  padding: var(--space-8); transition: opacity var(--t-large) var(--ease-out);
}
.half-time { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-secondary); letter-spacing: .06em; }
.half-title { font-family: var(--font-display); font-weight: 800; font-size: var(--text-xl); margin: var(--space-2) 0 var(--space-1); }
.half-role { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-4); }
.half-list { list-style: none; display: grid; gap: var(--space-2); }
.half-list li { padding-left: var(--space-6); position: relative; }
.half-list li::before { content: "▪"; position: absolute; left: 0; color: var(--accent-text); }
.half.night .half-list li::before { color: var(--expression-text); }
.stat-row { display: flex; gap: var(--space-6); margin-top: var(--space-6); }
.stat { display: flex; flex-direction: column; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-secondary); }
.stat b { font-family: var(--font-display); font-size: var(--text-xl); color: var(--text); letter-spacing: -.02em; }
/* the active half follows the theme: day=light, night=dark */
html[data-theme="light"] .half.night { opacity: .48; }
html[data-theme="dark"]  .half.day   { opacity: .48; }

/* ---------- 02 WORK ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-6); }
.card {
  background: var(--surface); border: var(--border-w) solid var(--stroke); box-shadow: var(--shadow);
  padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3);
  transition: transform var(--t-standard) var(--ease-out), box-shadow var(--t-standard) var(--ease-out);
}
.card:nth-child(odd)  { transform: rotate(-.6deg); }
.card:nth-child(even) { transform: rotate(.6deg); }
.card:hover { transform: rotate(0deg) translate(-3px,-3px); box-shadow: var(--shadow-hover); }
.card-top { display: flex; justify-content: space-between; align-items: baseline; }
.card-id { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent-text); letter-spacing: .04em; }
.card-ret { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-secondary); text-decoration: none; }
a.card-ret:hover { color: var(--expression-text); }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); line-height: 1.1; }
.card-desc { color: var(--text); font-size: var(--text-base); }
.card .tag-row { margin-top: auto; padding-top: var(--space-2); }

/* ---------- 03 PLAY ---------- */
.play-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-6); margin-bottom: var(--space-16); }
.play-card {
  background: var(--surface); border: var(--border-w) solid var(--stroke); box-shadow: var(--shadow);
  padding: var(--space-6); transition: transform var(--t-standard) var(--ease-out), box-shadow var(--t-standard) var(--ease-out);
}
.play-card:hover { transform: translate(-3px,-3px); box-shadow: var(--shadow-hover); }
.play-ico { font-size: var(--text-2xl); display: block; line-height: 1; color: var(--expression-text); }
.play-card h3 { font-family: var(--font-display); font-weight: 800; font-size: var(--text-lg); margin: var(--space-3) 0 var(--space-2); }
.play-card p { color: var(--text); }

.arcade {
  display: grid; grid-template-columns: 1fr auto; gap: var(--space-12); align-items: center;
  background: var(--surface-active); border: var(--border-w) solid var(--stroke); box-shadow: var(--shadow);
  padding: var(--space-12);
}
.arcade-title { font-family: var(--font-display); font-weight: 800; font-size: var(--text-xl); margin: var(--space-2) 0 var(--space-3); }
.arcade .score { font-family: var(--font-mono); font-size: var(--text-sm); margin-top: var(--space-4); color: var(--text-secondary); }
.arcade .score b { color: var(--accent-text); font-size: var(--text-base); }
.arcade-screen { display: grid; gap: var(--space-3); justify-items: center; }
#snake {
  width: 280px; height: 280px; image-rendering: pixelated;
  background: var(--background); border: var(--border-w) solid var(--stroke); box-shadow: var(--shadow-press);
}

/* ---------- 04 CONTACT (terminal) ---------- */
.terminal {
  max-width: 720px; border: var(--border-w) solid var(--stroke); box-shadow: var(--shadow);
  background: #14161a; color: #e8efe7; overflow: hidden;
}
.term-bar { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 2px solid #2a2e33; }
.td { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid #0a0b0d; }
.td1 { background: var(--accent-9); } .td2 { background: var(--purple-9); } .td3 { background: var(--warning-9); }
.term-name { font-family: var(--font-mono); font-size: var(--text-xs); color: #8b948c; margin-left: var(--space-2); }
.term-body { padding: var(--space-6); font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.9; }
.term-body p { margin: 0; }
.term-body .prompt { color: var(--accent-9); }
.term-body .out { color: #b9c2b8; padding-left: var(--space-4); }
.term-body .out a { color: #eaf3e8; text-decoration: underline; text-decoration-color: var(--purple-9); text-underline-offset: 3px; }
.term-body .out a:hover { color: var(--purple-9); }
.copy { font-family: var(--font-mono); font-size: var(--text-xs); cursor: pointer; margin-left: var(--space-2);
  background: transparent; color: var(--accent-9); border: 1px solid var(--accent-9); padding: 1px 8px; }
.copy:hover { background: var(--accent-9); color: #071009; }
.cursor { color: var(--accent-9); animation: blink 1.1s steps(1) infinite; }

/* ---------- FOOTER ---------- */
.foot {
  max-width: 1180px; margin: 0 auto; padding: var(--space-8) clamp(var(--space-4), 5vw, var(--space-24));
  border-top: var(--border-w) solid var(--stroke);
  display: flex; flex-wrap: wrap; gap: var(--space-4); justify-content: space-between; align-items: center;
  font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-secondary);
}
.foot a { text-decoration: none; } .foot a:hover { color: var(--accent-text); }

/* ---------- home: explore grid (doors to the category pages) ---------- */
.explore { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-6); }
.xcard {
  display: flex; flex-direction: column; gap: var(--space-2); text-decoration: none; color: var(--text);
  background: var(--surface); border: var(--border-w) solid var(--stroke); box-shadow: var(--shadow);
  padding: var(--space-8);
  transition: transform var(--t-standard) var(--ease-out), box-shadow var(--t-standard) var(--ease-out);
}
.xcard:hover { transform: translate(-4px,-4px); box-shadow: var(--shadow-hover); }
.xcard:active { transform: translate(4px,4px); box-shadow: var(--shadow-press); }
.xnum { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent-text); }
.xcard h3 { font-family: var(--font-display); font-weight: 800; font-size: var(--text-xl); line-height: 1; }
.xcard p { color: var(--text-secondary); font-size: var(--text-base); }
.xgo { margin-top: auto; font-family: var(--font-mono); font-size: var(--text-sm); color: var(--accent-text); padding-top: var(--space-2); }
.xcard:hover .xgo { color: var(--expression-text); }

/* ---------- extras: scroll bar + konami ---------- */
.scroll-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 50;
  background: var(--pixels); transform-origin: left center; transform: scaleX(0);
}
.rain { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.rain i { position: absolute; top: -24px; display: block; border: 1px solid var(--ink); animation: fall 2.4s linear forwards; }
@keyframes fall { to { transform: translateY(108vh) rotate(240deg); } }
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 61; pointer-events: none;
  font-family: var(--font-mono); font-size: var(--text-sm);
  background: var(--ink); color: var(--pixels);
  border: 2px solid var(--stroke); box-shadow: var(--shadow); padding: 10px 16px;
  opacity: 0; transform: translate(-50%, 18px); transition: opacity .25s var(--ease-out), transform .25s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- MOBILE ---------- */
@media (max-width: 720px) {
  .section { padding-top: var(--space-16); }
  .sec-title { font-size: var(--text-xl); }
  .flip { position: static; display: inline-block; margin-top: var(--space-4); box-shadow: var(--shadow-press); }
  .split { grid-template-columns: 1fr; }
  html[data-theme="light"] .half.night, html[data-theme="dark"] .half.day { opacity: 1; } /* both legible on mobile */
  .cards, .play-grid { grid-template-columns: 1fr; }
  .card:nth-child(odd), .card:nth-child(even) { transform: none; }
  .arcade { grid-template-columns: 1fr; padding: var(--space-8); }
  /* (Play-page arcade visibility now handled in play.css — games stay playable via swipe) */
  .foot { flex-direction: column; align-items: flex-start; }
  .copy { padding: 7px 12px; }                 /* >=44px tap target on touch */
  .term-body .out a, .foot a { display: inline-block; padding: 4px 0; }
}
