/* Theme: "ink & signal" — blacks and reds in both directions. Dark = red ink
   on near-black; light = crimson ink on warm paper. Hairline borders, uppercase
   section labels and the faint workshop grid carry over from the previous
   "technical workshop" theme; type stays Space Grotesk. Two palettes driven by
   data-theme on <html>, set pre-paint in theme.js. */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/space-grotesk-500.woff2") format("woff2");
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-700.woff2") format("woff2");
}

:root {
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

:root,
:root[data-theme="dark"] {
  --bg: #0c0a0b;
  --bg-panel: #141112;
  --bg-hover: #1d1719;
  --border: #2b2224;
  --border-strong: #4a3438;
  --text: #f2ecec;
  --text-muted: #a99c9e;
  --text-faint: #776b6d;
  --accent: #e5484d;
  --accent-strong: #ff6166;
  --accent-contrast: #16070a;
  --accent-dim: rgba(229, 72, 77, 0.12);
  --grid-line: rgba(229, 72, 77, 0.045);
  --card-shadow: rgba(229, 72, 77, 0.18);
}

:root[data-theme="light"] {
  --bg: #f6f2ef;
  --bg-panel: #fdfbfa;
  --bg-hover: #f0e8e5;
  --border: #e1d6d3;
  --border-strong: #c4b1ad;
  --text: #1a1214;
  --text-muted: #6d5b5f;
  --text-faint: #9c8b8e;
  --accent: #c8102e;
  --accent-strong: #a00d25;
  --accent-contrast: #ffffff;
  --accent-dim: rgba(200, 16, 46, 0.07);
  --grid-line: rgba(26, 18, 20, 0.04);
  --card-shadow: rgba(200, 16, 46, 0.14);
}

* {
  box-sizing: border-box;
}

::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px, 24px 24px, auto;
}

/* Register-mark stripe: dashed red ink line pinned to the top of the viewport */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--accent) 0 88px,
    transparent 88px 104px
  );
  z-index: 10;
  pointer-events: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.page {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2.75rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 2.5rem;
}

/* Header */

.site-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.brand {
  flex: 1;
  min-width: 0;
}

.site-header h1 {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.4rem;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.site-header h1::before {
  content: "";
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  margin-right: 0.45rem;
  border: 2px solid var(--accent);
  background: var(--accent-dim);
  transform: rotate(45deg);
}

/* Two-tone wordmark: "touch" in ink, "toys" in red */
.tt-red {
  color: var(--accent);
}

.tagline {
  margin: 0;
  color: var(--text-muted);
}

.header-controls {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-switch {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  padding: 0.45rem 0.55rem;
  color: var(--text-muted);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.lang-switch:hover {
  color: var(--accent);
  background: var(--bg-hover);
  border-color: var(--accent);
}

#theme-toggle {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.45rem 0.55rem;
  color: var(--text-muted);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

#theme-toggle:hover {
  color: var(--accent);
  background: var(--bg-hover);
  border-color: var(--accent);
}

/* Projects */

main {
  flex: 1;
}

.section-label {
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* Red-to-nothing rule after the label */
.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--border) 45%, transparent);
}

.projects {
  display: grid;
  gap: 1.25rem;
}

.card {
  position: relative;
  padding: 1.5rem 1.6rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

/* Red ink bar bleeds in from the left edge on hover */
.card::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 0.9rem;
  bottom: 0.9rem;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px -10px var(--card-shadow);
}

.card:hover::before {
  opacity: 1;
}

.card-index {
  position: absolute;
  top: 1.4rem;
  right: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.card:hover .card-index {
  color: var(--accent);
}

.card-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
  /* keep clear of the index number */
  padding-right: 2.5rem;
  flex-wrap: wrap;
}

.card-head h2,
.card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
}

.card > h2 {
  margin-bottom: 0.35rem;
}

.chip-live {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.14rem 0.5rem;
  white-space: nowrap;
}

.chip-live::before {
  content: "";
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  margin-right: 0.4em;
  border-radius: 50%;
  background: currentColor;
  animation: signal 2.4s ease-in-out infinite;
}

@keyframes signal {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.card p {
  margin: 0 0 0.75rem;
  line-height: 1.55;
}

.card p:last-child {
  margin-bottom: 0;
}

.card-stack {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
}

.card-actions {
  padding-top: 0.25rem;
}

.button {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--accent-contrast);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
}

.button::after {
  content: "→";
  display: inline-block;
  margin-left: 0.45em;
  transition: transform 0.18s ease;
}

.button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button:hover::after {
  transform: translateX(3px);
}

.card-soon {
  border-style: dashed;
  background: transparent;
  color: var(--text-muted);
}

.card-soon h2 {
  color: var(--text-muted);
}

.card-soon:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-strong);
}

.card-soon:hover::before {
  opacity: 0;
}

/* Entrance: cards rise in with a slight stagger */
@media (prefers-reduced-motion: no-preference) {
  .card {
    animation: rise 0.5s ease-out backwards;
  }
  .card:nth-child(2) { animation-delay: 0.08s; }
  .card:nth-child(3) { animation-delay: 0.16s; }
  .card:nth-child(4) { animation-delay: 0.24s; }
  .card:nth-child(5) { animation-delay: 0.32s; }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chip-live::before {
    animation: none;
  }
  .card,
  .button::after {
    transition: none;
  }
}

/* Footer */

.site-footer {
  position: relative;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

/* Short red ink mark on the footer rule */
.site-footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 3.5rem;
  height: 1px;
  background: var(--accent);
}

.site-footer p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}
