/* ==========================================================================
   Hadad Karsa — Cozy Lo-Fi Light / Dark Studio Design System
   Shared across /index.html (Gateway) and /profile/index.html (Profile)
   ========================================================================== */

:root {
  --bg: #F3F6FA;
  --surface: #FFFFFF;
  --surface-2: #E8EFF7;
  --ink: #162033;
  --ink-2: #3E4D66;
  --muted: #556580;
  --border: #D6E0EC;
  --border-strong: #B3C4D8;
  --accent: #2E5CE6;
  --accent-hover: #1F47C4;
  --accent-soft: #E3EBFF;
  --accent-ink: #FFFFFF;
  --play-1: #B54D12;
  --play-1-soft: #FCECE2;
  --play-2: #1F6E57;
  --play-2-soft: #E2F4EE;
  --shadow-card: 0 2px 0 var(--border-strong);
  --shadow-lift: 0 6px 0 var(--border-strong);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Fraunces", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101622;
    --surface: #172031;
    --surface-2: #1F2B40;
    --ink: #EEF3FA;
    --ink-2: #C0CCE0;
    --muted: #8E9EB8;
    --border: #26344B;
    --border-strong: #3A4E6E;
    --accent: #7BA4FF;
    --accent-hover: #9AB9FF;
    --accent-soft: #1C2C4A;
    --accent-ink: #0C1424;
    --play-1: #F49557;
    --play-1-soft: #312119;
    --play-2: #5AC9A3;
    --play-2-soft: #16302A;
    --shadow-card: 0 2px 0 #0A0E17;
    --shadow-lift: 0 6px 0 #0A0E17;
    color-scheme: dark;
  }
}

html[data-theme="dark"] {
  --bg: #101622;
  --surface: #172031;
  --surface-2: #1F2B40;
  --ink: #EEF3FA;
  --ink-2: #C0CCE0;
  --muted: #8E9EB8;
  --border: #26344B;
  --border-strong: #3A4E6E;
  --accent: #7BA4FF;
  --accent-hover: #9AB9FF;
  --accent-soft: #1C2C4A;
  --accent-ink: #0C1424;
  --play-1: #F49557;
  --play-1-soft: #312119;
  --play-2: #5AC9A3;
  --play-2-soft: #16302A;
  --shadow-card: 0 2px 0 #0A0E17;
  --shadow-lift: 0 6px 0 #0A0E17;
  color-scheme: dark;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

img, svg {
  display: block;
  max-width: 100%;
}

h1, h2, h3, h4 {
  color: var(--ink);
  text-wrap: balance;
  margin-top: 0;
}

p {
  text-wrap: pretty;
}

s,
.strike {
  color: var(--muted);
  opacity: 0.88;
  font-weight: 500;
  text-decoration-line: line-through;
  text-decoration-thickness: 1.75px;
  text-decoration-color: color-mix(in srgb, var(--play-1) 82%, var(--muted));
}

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

/* Interactive cursor & accessible focus defaults */
a[href], button:not(:disabled), summary, [role="button"] {
  cursor: pointer;
}

button:disabled, [aria-disabled="true"] {
  cursor: not-allowed;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Skip link */
.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 200;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  top: 16px;
}

/* Layout container */
.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Profile Topbar / Navigation (used on /profile/index.html only)
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  min-height: 44px;
  padding: 4px 2px;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-mark img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border-strong);
  flex-shrink: 0;
}

.brand-mark .brand-italic {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  padding: 8px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color 0.18s ease, background-color 0.18s ease;
}

.nav-links a:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.theme-toggle svg,
.menu-toggle svg,
.gw-theme-btn svg {
  flex-shrink: 0;
}

.ctrl-group {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
}

.ctrl-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 0 10px;
  min-height: 44px;
  min-width: 44px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.ctrl-btn:hover {
  color: var(--ink);
}

.ctrl-btn[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--ink);
}

.theme-toggle {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 0 12px;
  min-height: 46px;
  min-width: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.theme-toggle:active {
  transform: scale(0.97);
}

.menu-toggle {
  display: none;
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 0 12px;
  min-height: 46px;
  min-width: 44px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mobile-drawer {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 24px 18px;
}

.mobile-drawer.open {
  display: block;
}

.mobile-drawer a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 15.5px;
  border-bottom: 1px solid var(--border);
}

.mobile-drawer a:last-child {
  border-bottom: 0;
}

@media (max-width: 760px) {
  .nav-links {
    display: none;
  }
  .menu-toggle {
    display: inline-flex;
  }
}

@media (max-width: 560px) {
  .topbar .wrap {
    padding: 0 16px;
  }
  .topbar-in {
    gap: 8px;
  }
  .brand-mark {
    gap: 7px;
    font-size: 14px;
  }
  .brand-mark img {
    width: 28px;
    height: 28px;
  }
  .brand-mark .brand-italic {
    display: none;
  }
  .topbar-controls {
    gap: 6px;
  }
  .theme-toggle [data-theme-label] {
    display: none;
  }
  .theme-toggle {
    width: 44px;
    padding: 0;
  }
  .menu-toggle {
    padding: 0 10px;
    gap: 5px;
    font-size: 13px;
  }
}

@media (max-width: 360px) {
  .topbar .wrap {
    padding: 0 12px;
  }
  .brand-mark > span {
    display: none;
  }
}

/* ==========================================================================
   Buttons & Inline Signals
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  min-width: 44px;
  padding: 10px 20px;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn:active {
  transform: translateY(1px) scale(0.985);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-2px);
}

.btn-quiet {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-quiet:hover {
  background: var(--surface-2);
  border-color: var(--ink);
  transform: translateY(-2px);
}

.btn-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  padding: 8px 14px;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.btn-jump:hover {
  color: var(--accent);
  background: var(--surface-2);
}

.live-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--play-2);
  flex: none;
  display: inline-block;
}

/* ==========================================================================
   PAGE 1: NAVBAR-FREE MAIN GATEWAY (/index.html)
   ========================================================================== */
.gateway-main {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 4.5vh, 48px) 0 32px;
}

.page-gateway .site-footer {
  margin-top: 0;
}

.gateway-hub {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

/* Floating In-Body Controls Capsule */
.gw-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  margin-bottom: clamp(18px, 3vh, 28px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(22, 32, 51, 0.05);
}

.gw-lang-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.gw-pill-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

.gw-pill-btn:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}

.gw-lang-group .gw-pill-btn[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--ink);
}

.gw-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}

.gw-theme-btn {
  color: var(--ink);
}

.gw-theme-btn:active {
  transform: scale(0.96);
}

@media (max-width: 419px) {
  .gw-theme-btn [data-theme-label] {
    display: none;
  }
  .gw-theme-btn {
    width: 44px;
    padding: 0;
  }
}

/* Character Emblem */
.emblem-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 18px;
}

.emblem-btn {
  position: relative;
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  width: 156px;
  height: 156px;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.emblem-btn:hover {
  transform: translateY(-3px) rotate(-1.5deg);
}

.emblem-btn:active {
  transform: scale(0.96);
}

.emblem-ring {
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1.5px dashed var(--border-strong);
  pointer-events: none;
  transition: border-color 0.25s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.emblem-btn:hover .emblem-ring {
  border-color: var(--accent);
  transform: rotate(18deg);
}

.emblem-frame {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--border-strong), 0 12px 28px -14px rgba(22, 32, 51, 0.35);
  background: var(--surface-2);
}

.emblem-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.emblem-btn:hover .emblem-frame img {
  transform: scale(1.04);
}

.emblem-tag {
  position: absolute;
  bottom: -4px;
  right: -8px;
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  pointer-events: none;
}

.speech-bubble {
  margin-top: 14px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13.5px;
  color: var(--ink-2);
  box-shadow: 0 2px 8px rgba(22, 32, 51, 0.05);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.gateway-title {
  font-size: clamp(34px, 5vw, 50px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 12px 0 8px;
}

.gateway-title .serif-accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
}

.gateway-sub {
  max-width: 44ch;
  margin: 0 auto;
  color: var(--ink-2);
  font-size: clamp(15.5px, 1.8vw, 17px);
}

/* Line Hierarchy / Branching Tree */
.tree-stage {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 8px auto 0;
}

.tree-connector-wrap {
  position: relative;
  width: 100%;
  height: 92px;
}

.tree-svg-desktop {
  width: 100%;
  height: 92px;
  display: block;
  overflow: visible;
}

.tree-path {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: stroke 0.22s ease, stroke-width 0.22s ease;
}

.tree-path.is-soon {
  stroke-dasharray: 5 5;
  opacity: 0.7;
}

.tree-path.is-primary {
  stroke: var(--accent);
  stroke-width: 2.25;
}

.tree-path.is-lit {
  stroke: var(--accent);
  stroke-width: 2.5;
}

.tree-joint {
  fill: var(--bg);
  stroke: var(--border-strong);
  stroke-width: 2;
  transition: stroke 0.2s ease, fill 0.2s ease;
}

.tree-joint.is-primary,
.tree-joint.is-lit {
  stroke: var(--accent);
  fill: var(--accent);
}

.tree-joint-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-strong);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.tree-joint-dot.is-primary,
.tree-joint-dot.is-lit {
  border-color: var(--accent);
  background: var(--accent);
}

.branch-tier-primary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.branch-sub-connector {
  width: 100%;
  max-width: 660px;
  height: 44px;
  margin: 0 auto;
  display: block;
  overflow: visible;
}

.branch-tier-secondary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  max-width: 660px;
  margin: 0 auto;
}

/* Node Cards */
.node-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  text-decoration: none;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px 22px;
  color: var(--ink);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  width: 100%;
}

.node-card:hover:not(.node-soon),
.node-card:focus-visible:not(.node-soon) {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lift);
}

.node-card.node-featured {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--accent-soft) 35%, var(--surface)) 100%);
}

.node-card.node-soon {
  border-style: dashed;
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--surface) 65%, var(--bg));
  box-shadow: none;
  opacity: 0.88;
}

.node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.node-route {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 6px;
}

.node-soon .node-route {
  color: var(--muted);
  background: var(--surface-2);
}

.node-state {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--play-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.node-state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--play-2);
}

.node-state.state-ext {
  color: var(--muted);
}
.node-state.state-ext::before {
  background: var(--border-strong);
}

.node-state.state-soon {
  color: var(--muted);
}
.node-state.state-soon::before {
  background: transparent;
  border: 1.5px solid var(--muted);
}

.node-card h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  line-height: 1.25;
}

.node-card p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-2);
}

.node-action {
  margin-top: auto;
  padding-top: 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.node-card:hover .node-action .arrow-shift,
.detour-teaser:hover .arrow-shift {
  transform: translateX(3px);
}

.arrow-shift {
  display: inline-block;
  transition: transform 0.18s ease;
}

/* Mobile vertical line hierarchy reflow */
@media (max-width: 760px) {
  .gateway-main {
    justify-content: flex-start;
    padding: 24px 0 40px;
  }
  .emblem-btn {
    width: 132px;
    height: 132px;
  }
  .tree-connector-wrap,
  .tree-svg-desktop,
  .branch-sub-connector {
    display: none;
  }
  .tree-stage {
    margin-top: 26px;
    padding-left: 26px;
  }
  .tree-stage::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 24px;
    width: 2px;
    background: var(--border-strong);
    border-radius: 2px;
  }
  .branch-tier-primary,
  .branch-tier-secondary {
    grid-template-columns: 1fr;
    gap: 14px;
    max-width: none;
  }
  .branch-tier-secondary {
    margin-top: 14px;
  }
  .node-card::before {
    content: "";
    position: absolute;
    left: -17px;
    top: 28px;
    width: 16px;
    height: 2px;
    background: var(--border-strong);
  }
  .node-card.node-featured::before {
    background: var(--accent);
  }
  .node-card::after {
    content: "";
    position: absolute;
    left: -21px;
    top: 24px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--border-strong);
  }
  .node-card.node-featured::after {
    background: var(--accent);
    border-color: var(--accent);
  }
}

/* Quick Contact Dialog on Gateway */
dialog.studio-dialog {
  width: min(440px, calc(100vw - 32px));
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: 0 24px 56px rgba(16, 22, 34, 0.25);
}

dialog.studio-dialog::backdrop {
  background: rgba(16, 22, 34, 0.45);
  backdrop-filter: blur(4px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.dialog-head h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.dialog-sub {
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
}

.dialog-close {
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dialog-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.dialog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.dialog-row a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  word-break: break-all;
}

.dialog-row a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dialog-copy-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 16px;
  font-size: 14px;
}

.dialog-foot {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   PAGE 2: PERSONAL STUDIO DESK PROFILE (/profile/index.html)
   ========================================================================== */

/* Beat 1: Hero Studio + Interactive Desk Motto + Circular Ghibli Emblem */
.profile-hero {
  padding: 40px 0 36px;
}

.profile-hero-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.profile-h1 {
  font-size: clamp(38px, 5.6vw, 60px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0 0 14px;
  max-width: 24ch;
}

.profile-h1 .serif-accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
}

.profile-lede {
  color: var(--ink-2);
  font-size: clamp(15.5px, 1.5vw, 17px);
  line-height: 1.65;
  max-width: 56ch;
  margin: 0 auto 24px;
}

/* Interactive Desk Motto Card (above circular emblem) */
.motto-wrap {
  width: 100%;
  max-width: 540px;
  margin: 0 auto 24px;
}

.motto-chip {
  appearance: none;
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 12px 18px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-family: var(--font-sans);
  box-shadow: var(--shadow-card);
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.motto-chip:hover {
  border-color: var(--play-1);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.motto-chip:active {
  transform: translateY(0) scale(0.99);
}

.motto-pin {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--play-1);
  box-shadow: 0 0 0 4px var(--play-1-soft);
  flex-shrink: 0;
}

.motto-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.motto-line {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.motto-hint {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.35;
}

.motto-shuffle {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), color 0.18s ease, background-color 0.18s ease;
}

.motto-chip:hover .motto-shuffle {
  color: var(--play-1);
  background: var(--play-1-soft);
  transform: rotate(90deg);
}

/* Circular Ghibli Masked Character Emblem (matches Gateway emblem + slow orbit) */
@keyframes slowOrbit {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.profile-emblem-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 26px;
  padding: 10px;
}

.profile-emblem {
  position: relative;
  width: 176px;
  height: 176px;
  margin: 0;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.profile-emblem:hover {
  transform: translateY(-3px) rotate(-1.5deg);
}

.emblem-ring-orbit {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  pointer-events: none;
  animation: slowOrbit 28s linear infinite;
}

.profile-emblem .emblem-ring {
  inset: 0;
}

.profile-emblem:hover .emblem-ring {
  border-color: var(--accent);
  transform: rotate(18deg) scale(1.03);
}

.profile-emblem:hover .emblem-frame img {
  transform: scale(1.045);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
}

@media (max-width: 768px) {
  .profile-hero {
    padding: 30px 0 28px;
  }
  .profile-emblem {
    width: 148px;
    height: 148px;
  }
}

@media (max-width: 480px) {
  .profile-hero {
    padding: 24px 0 24px;
  }
  .profile-lede {
    margin-bottom: 20px;
  }
  .motto-wrap {
    margin-bottom: 20px;
  }
  .motto-chip {
    padding: 12px 14px;
    gap: 12px;
  }
  .profile-emblem-wrap {
    margin-bottom: 22px;
  }
}

/* Shared Section Rhythm */
.p-section {
  padding: clamp(52px, 7vh, 80px) 0;
  scroll-margin-top: 72px;
}

.p-section-tinted {
  background: color-mix(in srgb, var(--surface-2) 48%, var(--bg));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.beat-intro {
  margin-bottom: 32px;
  max-width: 56ch;
}

.beat-heading {
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 8px;
}

.beat-sub {
  margin: 0;
  font-size: 15.5px;
  color: var(--ink-2);
}

/* Beat 2: On the Desk (60/40 Split) */
.desk-split {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

.desk-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 32px;
}

.desk-cluster {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.desk-cluster h3 {
  font-size: 17.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.desk-cluster p {
  margin: 0 0 12px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-2);
}

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tool-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 6px;
}

/* Right 40%: After Hours Tinted Studio Card */
.after-hours-card {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
}

.ah-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 22px;
  color: var(--ink);
  margin: 0 0 18px;
  line-height: 1.25;
}

.ah-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ah-list li {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.ah-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.ah-list strong {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 3px;
}

.ah-list strong.ah-avail {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ah-list p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
}

.ah-list a {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.ah-list a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 900px) {
  .desk-split {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 580px) {
  .desk-matrix {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .after-hours-card {
    padding: 20px;
  }
}

/* Beat 3: The Detour (2-Chapter Interactive Ledger) */
.detour-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 28px;
  margin-bottom: 32px;
}

.filter-bar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.filter-tab {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 0 14px;
  min-height: 44px;
  border-radius: 9px;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.filter-tab:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.filter-tab[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.detour-ledger {
  display: flex;
  flex-direction: column;
}

.d-row {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 10px 32px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  align-items: baseline;
}

.d-row[hidden] {
  display: none;
}

.d-when {
  display: flex;
  align-items: center;
  gap: 8px;
}

.d-row.is-current .d-when::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--play-2);
  flex-shrink: 0;
}

.j-date {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.d-detail h3 {
  font-size: 18.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.j-org {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--accent);
  margin: 0 0 10px;
}

.j-body {
  color: var(--ink-2);
  font-size: 15px;
  margin: 0;
  max-width: 62ch;
}

.j-bullets {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--ink-2);
  font-size: 15px;
  max-width: 64ch;
}

.j-bullets li {
  margin: 5px 0;
}

/* Interactive Detour Teaser Button at foot of Chapter 1 */
.detour-teaser-wrap {
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.detour-teaser-wrap[hidden] {
  display: none;
}

.detour-teaser {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  min-height: 54px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.detour-teaser:hover {
  border-color: var(--accent);
  border-style: solid;
  color: var(--accent);
  background: var(--surface);
  transform: translateY(-2px);
}

.detour-teaser .arrow-shift {
  color: var(--accent);
  font-size: 18px;
  flex-shrink: 0;
}

.j-pivot {
  margin: 10px 0 14px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16.5px;
  color: var(--ink);
  align-self: flex-start;
}

.j-pivot[hidden] {
  display: none;
}

@media (max-width: 720px) {
  .d-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 20px 0;
  }
}

/* Beat 4: Balanced 3-Column Shelf */
.shelf-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 36px;
}

.shelf-col-head {
  font-size: 14px;
  font-weight: 700;
  color: var(--play-1);
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--border);
}

.shelf-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.shelf-item:last-child {
  border-bottom: 0;
}

.shelf-when {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  margin-bottom: 3px;
}

.shelf-item h4 {
  font-size: 15.5px;
  font-weight: 700;
  margin: 0 0 3px;
  line-height: 1.35;
}

.shelf-item p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
}

.pub-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 16.5px;
  line-height: 1.4;
}

@media (max-width: 840px) {
  .shelf-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

/* High-Contrast Drop a Note Closing Card */
.contact-section {
  padding-top: 12px;
  padding-bottom: 24px;
}

.contact-card {
  background: #162033;
  color: #EEF3FA;
  border: 1.5px solid #26344B;
  border-radius: var(--radius-lg);
  padding: clamp(26px, 4vw, 40px);
}

html[data-theme="dark"] .contact-card {
  background: #1A263D;
  border-color: var(--border-strong);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .contact-card {
    background: #1A263D;
    border-color: var(--border-strong);
  }
}

.contact-heading {
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #EEF3FA;
  margin: 0 0 6px;
}

.contact-sub {
  margin: 0 0 24px;
  font-size: 15.5px;
  color: #C0CCE0;
  max-width: 52ch;
}

.contact-mail-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 0;
  border-top: 1px solid rgba(192, 204, 224, 0.2);
  border-bottom: 1px solid rgba(192, 204, 224, 0.2);
  margin-bottom: 20px;
}

.big-email {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: clamp(22px, 3.8vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #FFFFFF;
  text-decoration: none;
  word-break: break-all;
}

.big-email:hover {
  color: #9AB9FF;
}

.btn-contact-copy {
  background: #FFFFFF;
  color: #162033;
  border-color: #FFFFFF;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 20px;
}

.btn-contact-copy:hover {
  background: #E3EBFF;
  border-color: #E3EBFF;
  transform: translateY(-2px);
}

.contact-foot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.contact-links a {
  color: #EEF3FA;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.contact-links a:hover {
  color: #9AB9FF;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.contact-reply-note {
  margin: 0;
  font-size: 13.5px;
  color: #A8B8D0;
}

/* Site Footer */
.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  padding: 20px 0 32px;
}

.footer-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  font-size: 13.5px;
  color: var(--muted);
}

.footer-in a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
}

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

/* Live Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 14px);
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  z-index: 120;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Gentle Hero Entrance (compositor-only) */
@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.enter {
  animation: riseIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.enter-d1 { animation-delay: 0.06s; }
.enter-d2 { animation-delay: 0.12s; }
.enter-d3 { animation-delay: 0.18s; }

/* Respect Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .emblem-ring-orbit {
    animation: none !important;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
