:root {
  --sage-1: #bac4af;
  --sage-2: #a9bd95;
  --sage-3: #8cab81;
  --sage-4: #799081;
  --sage-5: #526d51;
  --ink: #203127;
  --ink-soft: #3e5042;
  --cream: #eef1e9;
  --danger: #8d4f4f;
  --shadow: 0 24px 80px rgba(36, 52, 40, .20);
  --radius: 18px;
  --header-height: 72px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  transition: color .3s ease, background-color .3s ease;
}
body[data-mode="creative"] {
  --bg: #eef1e9;
  --bg-soft: #e1e8da;
  --panel: rgba(250,252,247,.78);
  --line: rgba(82,109,81,.20);
  --text: var(--ink);
  --muted: #5b6c5d;
  --accent: var(--sage-5);
  --accent-soft: var(--sage-2);
  --header-bg: rgba(238,241,233,.88);
  --widget-bg: rgba(238,241,233,.95);
}
body[data-mode="professional"] {
  --bg: #25362a;
  --bg-soft: #34483a;
  --panel: rgba(63,82,67,.82);
  --line: rgba(186,196,175,.20);
  --text: #eef1e9;
  --muted: #bac4af;
  --accent: #a9bd95;
  --accent-soft: #8cab81;
  --header-bg: rgba(37,54,42,.90);
  --widget-bg: rgba(31,46,35,.96);
  --shadow: 0 24px 80px rgba(0,0,0,.28);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: .65;
  background:
    radial-gradient(circle at 80% 0%, color-mix(in srgb, var(--sage-3) 28%, transparent), transparent 30rem),
    linear-gradient(color-mix(in srgb, var(--sage-5) 7%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--sage-5) 7%, transparent) 1px, transparent 1px);
  background-size: auto, 36px 36px, 36px 36px;
}
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 48%, transparent); outline-offset: 2px; }
.eyebrow { color: var(--accent); letter-spacing: .16em; font-size: .74rem; font-weight: 900; }
h1,h2,h3,p { margin-top: 0; }
h1 { font-size: clamp(3rem, 7vw, 6.2rem); line-height: .94; letter-spacing: -.055em; max-width: 12ch; margin-bottom: 1.4rem; }
h2 { font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1; letter-spacing: -.04em; max-width: 17ch; }
h3 { font-size: 1.35rem; margin-bottom: .8rem; }
p { color: var(--muted); line-height: 1.7; }

/* Access */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 3rem 1.25rem;
  --bg: #eef1e9;
  --bg-soft: #dfe7d8;
  --panel: rgba(250,252,247,.82);
  --line: rgba(82,109,81,.22);
  --text: var(--ink);
  --muted: #5b6c5d;
  --accent: var(--sage-5);
  --header-bg: rgba(238,241,233,.9);
}
.auth-shell { width: min(1120px, 100%); display: grid; grid-template-columns: 1.2fr .8fr; gap: 2rem; align-items: stretch; }
.auth-brand, .auth-panel, .project-card, .experience-card, .hero-console, .capability-columns article { border: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 92%, white 8%), var(--panel)); box-shadow: var(--shadow); }
.auth-brand { padding: clamp(2rem, 5vw, 5rem); border-radius: 28px; min-height: 620px; display: flex; flex-direction: column; justify-content: center; background: linear-gradient(140deg, #eef1e9 0 48%, #dce5d4 48% 70%, #c8d7bd 70%); }
.auth-brand h1 { margin-top: 1rem; }
.hero-kicker { color: var(--text); font-weight: 750; font-size: 1.05rem; }
.auth-copy { max-width: 58ch; }
.signal-card { margin-top: auto; padding-top: 2rem; display: grid; grid-template-columns: auto 1fr; gap: .65rem 1rem; border-top: 1px solid var(--line); color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; }
.signal-card strong { color: var(--text); font-weight: 650; }
.auth-panel { border-radius: 28px; padding: 1.5rem; display: flex; flex-direction: column; justify-content: center; }
.panel-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; background: #d8e1d0; border-radius: 12px; padding: .35rem; margin-bottom: 1.5rem; }
.tab { border: 0; border-radius: 9px; padding: .8rem; color: var(--muted); background: transparent; }
.tab.active { background: #f4f6f1; color: var(--text); }
.auth-form { display: grid; gap: 1rem; }
.auth-form label { display: grid; gap: .45rem; font-size: .85rem; color: var(--muted); }
.auth-form input, .ticker-editor input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: .95rem 1rem; color: var(--text); background: color-mix(in srgb, var(--bg-soft) 70%, white 30%); outline: none; }
.auth-form input:focus, .ticker-editor input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.primary-button, .ghost-button { border-radius: 10px; padding: .9rem 1.05rem; text-decoration: none; font-weight: 850; border: 1px solid transparent; }
.primary-button { color: #f6f8f3; background: var(--sage-5); }
body[data-mode="professional"] .primary-button { color: #203127; background: var(--sage-2); }
.ghost-button { color: var(--text); border-color: var(--line); background: transparent; }
.button-link { display: inline-flex; align-items: center; justify-content: center; }
.form-message { min-height: 1.4rem; margin: 0; font-size: .85rem; }
.form-message.error { color: var(--danger); }
.microcopy { margin-top: 1.2rem; font-size: .76rem; }

/* Header and mode */
.site-header { position: sticky; top: 0; z-index: 20; min-height: var(--header-height); display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; padding: .7rem clamp(1rem, 4vw, 4rem); border-bottom: 1px solid var(--line); background: var(--header-bg); backdrop-filter: blur(18px); }
.header-left { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.brand-mark { text-decoration: none; font-weight: 950; letter-spacing: .05em; white-space: nowrap; }
.mode-switch { display: flex; gap: .25rem; padding: .25rem; border-radius: 10px; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg-soft) 82%, transparent); }
.mode-button { border: 0; border-radius: 7px; padding: .55rem .72rem; color: var(--muted); background: transparent; font-size: .72rem; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.mode-button.active { color: #f5f7f2; background: var(--sage-5); }
body[data-mode="professional"] .mode-button.active { color: var(--ink); background: var(--sage-2); }
.site-nav, .nav-mode { display: flex; align-items: center; gap: 1.2rem; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: .84rem; }
.site-nav a:hover { color: var(--text); }
body[data-mode="creative"] .professional-nav, body[data-mode="professional"] .creative-nav { display: none; }

/* Mode content */
.creative-copy, .professional-copy, .creative-section-group, .professional-section-group, .creative-widget, .professional-widget { transition: opacity .22s ease; }
body[data-mode="creative"] .professional-copy,
body[data-mode="creative"] .professional-section-group,
body[data-mode="creative"] .professional-widget { display: none !important; }
body[data-mode="professional"] .creative-copy,
body[data-mode="professional"] .creative-section-group,
body[data-mode="professional"] .creative-widget { display: none !important; }
.section-pad { padding: clamp(5rem, 9vw, 9rem) clamp(1.25rem, 7vw, 8rem); }
.hero { min-height: calc(100vh - var(--header-height)); display: grid; grid-template-columns: 1.25fr .75fr; gap: 4rem; align-items: center; }
.hero-copy { max-width: 62ch; font-size: 1.06rem; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 2rem; }
.hero-console { border-radius: var(--radius); padding: 1.2rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
/* Keep the static status panel clear of the fixed visitor widget at the top of the page. */
@media (min-width: 1001px) {
  .portfolio-page .hero-console { margin-top: 8rem; }
}
.console-line { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); font-size: .75rem; }
.console-line:last-child { border-bottom: 0; }
.console-line span { color: var(--muted); }
.console-line strong { text-align: right; color: var(--accent); }
.section-block { border-top: 1px solid var(--line); }
.section-heading { display: grid; gap: 1rem; margin-bottom: 2rem; }
.project-card, .experience-card { border-radius: var(--radius); padding: clamp(1.4rem, 3vw, 2.4rem); transition: transform .2s ease, border-color .2s ease; }
.project-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.project-label, .year-range { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .74rem; letter-spacing: .08em; }
.feature-grid { display: grid; grid-template-columns: 1.4fr .6fr; gap: 2rem; }
.project-meta { display: grid; gap: 1rem; align-content: start; }
.project-meta div { display: grid; gap: .25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.project-meta span { color: var(--muted); font-size: .7rem; }
.text-link { color: var(--accent); text-decoration: none; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.tag-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1.25rem; }
.tag-row span, .skills-strip span { border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 70%, transparent); border-radius: 999px; padding: .45rem .7rem; color: var(--text); font-size: .72rem; }
.experience-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.skills-strip { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }
.music-section { display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.capability-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.capability-columns article { padding: 1.6rem; border-radius: var(--radius); }
.contact-section { padding-bottom: 13rem; }

/* Visitor widgets */
.visitor-widget { position: fixed; right: 1rem; top: calc(var(--header-height) + 1rem); z-index: 30; width: 286px; border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent); background: var(--widget-bg); backdrop-filter: blur(18px); box-shadow: 0 18px 50px rgba(25,39,28,.28); border-radius: 16px; padding: .9rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; }
.widget-topline, .widget-user, .visitor-widget dl div, .market-mini-list div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.widget-topline { color: var(--accent); margin-bottom: .65rem; font-weight: 800; letter-spacing: .05em; }
.icon-button { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--text); }
.widget-user { padding: .7rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.widget-user span, .visitor-widget dt { color: var(--muted); }
.visitor-widget dl { display: grid; gap: .45rem; margin: .8rem 0; }
.visitor-widget dd { margin: 0; color: var(--text); }
.widget-button { width: 100%; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 8px; padding: .55rem; }
.widget-button:hover { color: var(--text); }
.widget-toast { max-height: 0; opacity: 0; overflow: hidden; color: var(--accent); transition: .25s ease; }
.widget-toast.show { max-height: 60px; opacity: 1; padding: .5rem 0; }

.mini-aquarium, .large-aquarium { position: relative; overflow: hidden; border: 1px solid color-mix(in srgb, var(--sage-5) 30%, transparent); background: linear-gradient(180deg, #dfe8d7 0%, #c6d8bc 46%, #9cb997 100%); }
.mini-aquarium { height: 112px; border-radius: 10px; margin-bottom: .65rem; }
.large-aquarium { height: min(48vh, 390px); min-height: 280px; border-radius: 16px; }
.water-line { position: absolute; left: 0; right: 0; top: 11px; border-top: 1px solid rgba(255,255,255,.7); }
.sand { position: absolute; left: 0; right: 0; bottom: 0; height: 18%; background: linear-gradient(180deg, #a9bd95, #8cab81); clip-path: polygon(0 35%, 12% 15%, 25% 38%, 39% 18%, 55% 45%, 75% 20%, 100% 40%, 100% 100%, 0 100%); }
.plant { position: absolute; bottom: 10px; width: 8px; height: 44px; border-radius: 100% 0; background: var(--sage-5); transform-origin: bottom; animation: sway 3.2s ease-in-out infinite alternate; }
.plant::before, .plant::after { content: ""; position: absolute; width: 16px; height: 8px; border-radius: 100%; background: var(--sage-4); }
.plant::before { left: -10px; top: 14px; transform: rotate(25deg); }
.plant::after { left: 3px; top: 26px; transform: rotate(-25deg); }
.plant-a { left: 14%; }.plant-b { right: 16%; height: 56px; animation-delay: -1.1s; }
.fish-layer { position: absolute; inset: 0; overflow: hidden; }
.fish { position: absolute; top: var(--lane); left: -42px; width: calc(var(--fish-size) * 1.55); height: var(--fish-size); border-radius: 55% 45% 48% 52%; background: var(--sage-5); animation: swim var(--duration) linear infinite; animation-delay: var(--delay); filter: drop-shadow(0 2px 2px rgba(40,60,42,.12)); }
.fish::after { content: ""; position: absolute; right: 92%; top: 18%; border-top: calc(var(--fish-size) * .32) solid transparent; border-bottom: calc(var(--fish-size) * .32) solid transparent; border-right: calc(var(--fish-size) * .52) solid var(--sage-4); }
.fish::before { content: ""; position: absolute; right: 19%; top: 24%; width: 3px; height: 3px; border-radius: 50%; background: #eef1e9; box-shadow: 0 0 0 1px rgba(32,49,39,.18); }
.fish.reverse { animation-name: swim-reverse; transform: scaleX(-1); background: var(--sage-4); }
@keyframes swim { from { transform: translateX(-10px); } to { transform: translateX(360px); } }
@keyframes swim-reverse { from { transform: translateX(360px) scaleX(-1); } to { transform: translateX(-10px) scaleX(-1); } }
@keyframes sway { from { transform: rotate(-5deg); } to { transform: rotate(6deg); } }

.market-mini-list { display: grid; gap: .32rem; margin: .75rem 0; }
.market-mini-list div { padding: .38rem 0; border-bottom: 1px solid var(--line); }
.market-mini-list strong { color: var(--text); letter-spacing: .05em; }
.market-mini-list span { color: var(--muted); font-size: .62rem; }
.market-disclaimer { font-size: .62rem; line-height: 1.45; margin: .6rem 0; }
.professional-stats { border-top: 1px solid var(--line); padding-top: .65rem; }

.widget-popout { position: fixed; right: 1rem; top: calc(var(--header-height) + 1rem); z-index: 40; width: min(760px, calc(100vw - 2rem)); max-height: calc(100vh - var(--header-height) - 2rem); overflow: auto; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--widget-bg); backdrop-filter: blur(22px); box-shadow: 0 28px 90px rgba(17,29,20,.38); border-radius: 20px; padding: 1.2rem; }
.widget-popout[hidden] { display: none; }
.popout-header { display: flex; align-items: start; justify-content: space-between; gap: 2rem; margin-bottom: 1rem; }
.popout-header h3 { margin: .3rem 0 0; font-size: 1.3rem; }
.popout-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: .7rem; margin-top: 1rem; }
.popout-stats div { display: grid; gap: .3rem; padding: .9rem; border: 1px solid var(--line); border-radius: 10px; }
.popout-stats span { color: var(--muted); font-size: .62rem; }
.ticker-editor { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: .7rem; align-items: end; margin-bottom: 1rem; }
.ticker-editor label { display: grid; gap: .35rem; color: var(--muted); font-size: .68rem; }
.ticker-editor input { padding: .72rem; text-transform: uppercase; }
.market-chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.market-chart-card { border: 1px solid var(--line); border-radius: 12px; padding: .8rem; }
.market-chart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .65rem; }
.market-chart-head span { color: var(--muted); font-size: .62rem; }
.chart-placeholder { position: relative; height: 150px; overflow: hidden; border-radius: 8px; background: color-mix(in srgb, var(--bg-soft) 82%, transparent); display: grid; place-items: center; text-align: center; }
.chart-placeholder::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 49px, var(--line) 50px), repeating-linear-gradient(0deg, transparent 0 36px, var(--line) 37px); opacity: .7; }
.chart-placeholder p { position: relative; z-index: 1; margin: 0; font: 650 .66rem/1.55 ui-monospace, monospace; letter-spacing: .08em; color: var(--muted); }
.market-note { margin: 1rem 0 0; font-size: .72rem; }
body.popout-open .visitor-widget { opacity: .18; pointer-events: none; }

@media (max-width: 1000px) {
  .auth-shell, .hero, .feature-grid, .experience-grid { grid-template-columns: 1fr; }
  .portfolio-page .hero { padding-top: clamp(9rem, 18vw, 12rem); }
  .portfolio-page .hero-console { margin-top: 0; }
  .auth-brand { min-height: auto; }
  .card-grid, .capability-columns { grid-template-columns: 1fr; }
  .site-nav { display: none; }
  .music-section { align-items: start; flex-direction: column; }
  .ticker-editor { grid-template-columns: repeat(2, 1fr); }
  .ticker-editor .primary-button { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .site-header { align-items: stretch; flex-direction: column; }
  .header-left { justify-content: space-between; }
  .brand-mark { font-size: .82rem; }
  .mode-button { padding: .5rem .6rem; font-size: .66rem; }
  .section-pad { padding-left: 1rem; padding-right: 1rem; }
  :root { --header-height: 116px; }
  .visitor-widget { right: .65rem; top: calc(var(--header-height) + .65rem); width: min(286px, calc(100vw - 1.3rem)); }
  .widget-popout { right: .65rem; top: calc(var(--header-height) + .65rem); width: calc(100vw - 1.3rem); max-height: calc(100vh - var(--header-height) - 1.3rem); }
  .market-chart-grid, .popout-stats { grid-template-columns: 1fr; }
  .contact-section { padding-bottom: 22rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* V0.4 project case studies */
.case-study-button {
  margin-top: 1.15rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  color: var(--text);
  padding: .72rem .9rem;
  border-radius: 10px;
  font: inherit;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.case-study-button:hover { transform: translateY(-1px); border-color: var(--accent); background: var(--panel-strong); }
.case-study-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: clamp(.7rem, 2vw, 1.5rem);
  background: rgba(18, 29, 22, .78);
  backdrop-filter: blur(10px);
  overflow: auto;
}
.case-study-panel {
  width: min(1180px, 100%);
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(15, 27, 18, .34);
  overflow: hidden;
}
.case-study-header {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: start;
  padding: clamp(1.2rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line);
}
.case-study-header h2 { margin: .35rem 0 .5rem; max-width: 820px; }
.case-study-subtitle { margin: 0; max-width: 780px; color: var(--muted); font-size: 1.02rem; }
.case-study-close { flex: 0 0 auto; font-size: 1.25rem; }
.case-study-media { padding: clamp(1rem, 2vw, 1.5rem) clamp(1.2rem, 3vw, 2.5rem); border-bottom: 1px solid var(--line); }
.case-study-media-grid { display: grid; grid-template-columns: 1.7fr 1fr 1fr; gap: .8rem; }
.media-slot {
  min-height: 170px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 55%),
    var(--panel);
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .12em;
  text-align: center;
}
.media-slot-primary { min-height: 250px; }
.media-note { margin: .75rem 0 0; color: var(--muted); font-size: .78rem; }
.case-study-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .75fr); gap: 2rem; padding: clamp(1.2rem, 3vw, 2.5rem); }
.case-study-main { display: grid; gap: 1.8rem; }
.case-study-main section { padding-bottom: 1.4rem; border-bottom: 1px solid var(--line); }
.case-study-main section:last-child { border-bottom: 0; padding-bottom: 0; }
.case-study-main p { margin: .65rem 0 0; line-height: 1.75; }
.case-label { color: var(--accent); font-size: .7rem; letter-spacing: .14em; font-weight: 700; }
.case-list { margin: .75rem 0 0; padding-left: 1.2rem; display: grid; gap: .7rem; line-height: 1.55; }
.case-study-side { display: grid; align-content: start; gap: 1rem; }
.case-fact { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.case-fact span { display: block; color: var(--muted); font-size: .66rem; letter-spacing: .12em; margin-bottom: .32rem; }
.case-fact strong { font-size: .92rem; line-height: 1.35; }
body.case-study-open { overflow: hidden; }
@media (max-width: 820px) {
  .case-study-media-grid, .case-study-grid { grid-template-columns: 1fr; }
  .media-slot, .media-slot-primary { min-height: 150px; }
  .case-study-header { gap: 1rem; }
}

/* V0.6 professional case-study refinements */
.professional-case-card { display: flex; flex-direction: column; align-items: flex-start; }
.professional-case-card .case-study-button { margin-top: auto; }
.case-teaser { padding-top: .9rem; border-top: 1px solid var(--line); color: var(--muted); }
.capability-columns-expanded { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.creative-tools-section .section-heading p { max-width: 760px; color: var(--muted); }
@media (max-width: 760px) { .capability-columns-expanded { grid-template-columns: 1fr; } }
