/* "Snow Tiger" theme — palette taken from the white tiger cubs nihonga painting:
   misty steel-blue sky, snow-white fur, ink-brown stripes, gold signature; accent is the deep indigo of the lilies.
   Loaded after style.css; remove its <link> in index.html to go back to the dark theme. */

:root {
  --bg: #dfe5ea;
  --card: rgba(250, 251, 252, 0.72);
  --text: #2a2420;
  --muted: #5f6d7c;
  --accent: #1f3a5f;
  --gold: #b8923f;
  --gold-ink: #9a7a35;
  --sky: #6f8ba6;
  --sky-deep: #3b5874;
  --snow: #f7f8f9;
  --ink-soft: #4a403a;
  --line: rgba(42, 36, 32, 0.12);
  --shadow: 0 18px 40px rgba(53, 74, 98, 0.16);
  --serif: "Shippori Mincho", "Noto Serif JP", Georgia, serif;
}

body {
  background:
    linear-gradient(180deg,
      #6f8ba6 0px,
      #93aabf 380px,
      #c3d0dc 900px,
      #e2e6e8 1500px,
      #ece6da 100%);
  color: var(--text);
}

body::before {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), transparent 70%);
  opacity: 0.7;
}

body::after {
  background: radial-gradient(circle, rgba(232, 214, 196, 0.6), transparent 70%);
  opacity: 0.6;
}

.side-rail {
  background: linear-gradient(180deg, transparent, rgba(42, 36, 32, 0.35), transparent);
}

/* ---------- Typography ---------- */

h1,
h2,
h3,
.logo {
  font-family: var(--serif);
  letter-spacing: 0.01em;
}

h1 {
  font-weight: 700;
  color: var(--text);
}

.section__title {
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
  font-size: 32px;
}

/* brush-like "stripe" under section titles */
.section__title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 64px;
  height: 4px;
  border-radius: 4px 1px 6px 1px;
  background: linear-gradient(90deg, var(--text) 0 70%, transparent 70% 76%, var(--text) 76%);
  opacity: 0.85;
}

/* ---------- Header ---------- */

.header {
  background: rgba(247, 248, 249, 0.72);
  border-bottom: 1px solid var(--line);
}

.logo {
  color: var(--text);
}

.logo span {
  color: var(--accent);
}

.nav a {
  color: var(--ink-soft);
}

.nav a:hover {
  color: var(--accent);
}

/* ---------- Cards ---------- */

.photo-card,
.panel,
.project,
.contact-card,
.job,
.process__step,
.gif-strip,
.gif-inline {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.panel:hover,
.project:hover,
.contact-card:hover,
.job:hover {
  border-color: rgba(31, 58, 95, 0.35);
  box-shadow: 0 22px 50px rgba(31, 58, 95, 0.1), var(--shadow);
}

.photo-card img {
  filter: saturate(0.92);
}

.panel p,
.project p,
.contact-card p,
.job p:last-child,
.hero__text {
  color: var(--ink-soft);
}

/* ---------- Hero ---------- */

.badge {
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent);
  border: 1px solid rgba(31, 58, 95, 0.25);
}

.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
}

.hero__subtitle {
  color: var(--sky-deep);
}

.button {
  border: 1px solid var(--line);
}

.button--primary {
  background: var(--accent);
  color: var(--snow);
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(31, 58, 95, 0.25);
}

.button--secondary {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
}

.button--secondary:hover {
  border-color: var(--gold);
}

/* ---------- Skills ---------- */

.skill {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(79, 109, 138, 0.22);
  color: var(--text);
}

.skill:hover {
  border-color: var(--sky-deep);
}

/* ---------- Experience ---------- */

/* small secondary text uses the sky blue; deep indigo is reserved for real accents */
.job p.job__company,
.panel p.job__company,
.project__tech,
.process__tools {
  color: var(--sky-deep);
}

.job__highlight-icon {
  color: var(--accent);
}

.job__period,
.job__location {
  color: var(--muted);
}

.job__highlight {
  border-top: 1px dashed rgba(42, 36, 32, 0.18);
  color: var(--text);
}

.job__thumb {
  border: 1px solid var(--line);
}

/* ---------- Links ---------- */

.project__links a,
.contact-card a {
  color: var(--sky-deep);
  text-decoration-color: rgba(79, 109, 138, 0.4);
}

.project__links a:hover,
.contact-card a:hover {
  color: var(--accent);
}

/* ---------- Floating toggles ---------- */

.mode-toggle {
  background: rgba(247, 248, 249, 0.9);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(53, 74, 98, 0.2);
}

.mode-toggle:hover {
  border-color: var(--accent);
}

.demo-toggle {
  background: rgba(31, 58, 95, 0.08);
  border: 1px solid rgba(31, 58, 95, 0.3);
  color: var(--accent);
}

.demo-toggle:hover {
  background: rgba(31, 58, 95, 0.15);
}

.demo-toggle.is-open {
  background: var(--accent);
  color: var(--snow);
}

/* ---------- How I Work ---------- */

.process__num {
  font-family: var(--serif);
  background: rgba(255, 255, 255, 0.6);
}

.process__step p {
  color: var(--ink-soft);
}

/* ---------- Footer ---------- */

.footer {
  color: var(--muted);
}

/* animated handwritten signature above the copyright, drawn when scrolled into view */
.signature {
  max-width: 440px;
  margin: 0 auto 4px;
}

.signature svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.signature__name {
  font-family: "Mrs Saint Delafield", cursive;
  font-size: 118px;
  fill: var(--accent);
  fill-opacity: 0;
  stroke: var(--accent);
  stroke-width: 1.1;
  stroke-dasharray: 2600;
  stroke-dashoffset: 2600;
}

.signature__line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
}

/* gold seal, like the artist's mark on the painting */
.signature__seal {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(1.6) rotate(-4deg);
}

.signature__seal rect {
  fill: none;
  stroke: var(--gold-ink);
  stroke-width: 2.5;
}

.signature__seal text {
  fill: var(--gold-ink);
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
}

.signature.is-visible .signature__name {
  animation: sigDraw 3.6s cubic-bezier(0.55, 0.1, 0.35, 1) 0.3s forwards,
    sigInk 1.2s ease 3.3s forwards;
}

.signature.is-visible .signature__line {
  animation: sigDraw 1.1s ease-out 3.6s forwards;
}

.signature.is-visible .signature__seal {
  animation: sigStamp 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) 4.6s forwards;
}

@keyframes sigDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes sigInk {
  to { fill-opacity: 1; stroke-width: 0.4; }
}

@keyframes sigStamp {
  to { opacity: 1; transform: scale(1) rotate(-4deg); }
}

@media (prefers-reduced-motion: reduce) {
  .signature__name,
  .signature.is-visible .signature__name {
    animation: none;
    stroke-dashoffset: 0;
    fill-opacity: 1;
    stroke-width: 0.4;
  }
  .signature__line,
  .signature.is-visible .signature__line {
    animation: none;
    stroke-dashoffset: 0;
  }
  .signature__seal,
  .signature.is-visible .signature__seal {
    animation: none;
    opacity: 1;
    transform: rotate(-4deg);
  }
}

.gif-fbi p {
  color: var(--muted);
}

/* ---------- Art strips (replace the old GIFs) ---------- */

.gif-strip,
.gif-inline {
  height: 300px;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.gif-strip img,
.gif-inline img {
  filter: saturate(0.95) contrast(1.02);
}

.gif-fbi {
  margin-top: 22px;
}

/* ---------- Mode toggle position ---------- */

/* keep the toggle off the nav: bottom-right corner */
.mode-toggle {
  top: auto;
  bottom: 18px;
  right: 18px;
}

/* ---------- Engineering Mode: "blueprint on rice paper" ---------- */

.engineering-mode {
  --eng-ink: rgba(42, 36, 32, 0.07);
  --eng-line: rgba(31, 58, 95, 0.35);
}

body.engineering-mode {
  background:
    linear-gradient(var(--eng-ink) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--eng-ink) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(180deg, #dfe6ec 0%, #eef0ef 40%, #efeae0 100%);
}

.engineering-mode .section .container,
.engineering-mode .hero .container {
  border: 1px dashed var(--eng-line);
  background: rgba(255, 255, 255, 0.25);
}

.engineering-mode .mode-toggle {
  background: var(--text);
  color: var(--snow);
  border-color: var(--text);
}

.component-tag,
.component-info {
  background: var(--snow);
  border: 1px solid var(--eng-line);
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(53, 74, 98, 0.12);
}

.component-info:hover {
  background: var(--accent);
  color: var(--snow);
}

.component-info .component-docs,
.component-tree {
  background: rgba(250, 250, 248, 0.97);
  border: 1px solid rgba(42, 36, 32, 0.15);
  color: var(--text);
  box-shadow: 0 20px 50px rgba(53, 74, 98, 0.22);
}

.component-docs h4,
.component-docs .prop-name,
.component-tree__head {
  color: var(--accent);
}

.component-docs .doc-section,
.component-tree__head {
  border-color: rgba(42, 36, 32, 0.12);
}

.component-docs .doc-label { color: var(--muted); }
.component-docs .type-string { color: #3f7d4e; }
.component-docs .type-boolean { color: var(--sky-deep); }
.component-docs .type-number { color: #b0662a; }
.component-docs .type-array { color: #7a4f8f; }
.component-docs .type-object { color: #a8436b; }
.component-docs .default-val { color: #8a8580; }

.component-tree__list li {
  color: var(--text);
}

.component-tree__list li::before {
  color: rgba(31, 58, 95, 0.5);
}

.component-tree__list li:hover {
  background: rgba(31, 58, 95, 0.08);
  color: var(--accent);
}

.component-tree__close {
  color: var(--muted);
  border-color: rgba(42, 36, 32, 0.15);
}

.section.is-highlighted .container,
.hero.is-highlighted .container {
  box-shadow: 0 0 0 2px var(--accent), 0 30px 60px rgba(31, 58, 95, 0.15);
}

.dev-badge {
  background: var(--snow);
  border: 1px solid var(--eng-line);
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(53, 74, 98, 0.12);
}

.engineering-mode .footer p::after {
  color: var(--accent);
}

/* the tree covers content when the side margins are narrow */
@media (max-width: 1640px) {
  .component-tree {
    top: auto;
    bottom: 60px;
    max-height: 45vh;
  }
}

/* ---------- Smooth mode switch ---------- */

/* cross-fade of the whole page (View Transitions API, see script.js) */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.7s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* fallback + extra polish: overlays fade in instead of popping */
.engineering-mode .component-tag,
.engineering-mode .component-info,
.engineering-mode .component-tree,
.engineering-mode .dev-badge {
  animation: engFadeIn 0.6s ease both;
}

@keyframes engFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.section .container,
.hero .container {
  transition: border-color 0.5s ease, background-color 0.5s ease, padding 0.5s ease;
}

.mode-toggle {
  transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, transform 0.25s;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root),
  .engineering-mode .component-tag,
  .engineering-mode .component-info,
  .engineering-mode .component-tree,
  .engineering-mode .dev-badge {
    animation: none;
  }
}
