/* prjwl.dev: one violet accent, dark by default, light on request. */
:root {
  --bg: #1b1726; --surface: #252034; --surface-2: #2f2942; --line: #3f3757;
  --text: #f1eef8; --muted: #b9b2cb; --violet: #a855f7; --violet-hi: #d8b4fe; --violet-deep: #7c3aed;
  --accent-text: #d8b4fe; --on-accent: #fff;
  --display: 'Outfit', system-ui, 'Hiragino Sans', 'Noto Sans JP', 'Yu Gothic', sans-serif;
  --body: 'Space Grotesk', system-ui, 'Hiragino Sans', 'Noto Sans JP', 'Yu Gothic', sans-serif;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, 'Hiragino Mincho ProN', 'Kohinoor Devanagari', 'Noto Serif Devanagari', serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --r: 20px; --gutter: clamp(16px, 4vw, 32px); --gap: clamp(12px, 1.6vw, 18px);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #faf9fd; --surface: #fff; --surface-2: #f3f0fa; --line: #e3deef;
    --text: #1a1626; --muted: #625a75; --accent-text: #6d28d9;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #faf9fd; --surface: #fff; --surface-2: #f3f0fa; --line: #e3deef;
  --text: #1a1626; --muted: #625a75; --accent-text: #6d28d9;
  color-scheme: light;
}

/* Language switch and tab changes cross-fade instead of cutting. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .24s; animation-timing-function: ease; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0; color: var(--text); overflow-wrap: break-word;
  font: 400 clamp(1rem, .96rem + .2vw, 1.075rem)/1.65 var(--body);
  background:
    radial-gradient(60rem 34rem at 88% -8rem, color-mix(in srgb, var(--violet) 11%, transparent), transparent 70%) no-repeat,
    var(--bg);
}
:lang(ja) body { line-height: 1.85; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
p, li { text-wrap: pretty; }
ul, ol { list-style: none; }
a { color: var(--accent-text); text-underline-offset: 3px; }
svg { width: 1.1em; height: 1.1em; flex: none; }
::selection { background: color-mix(in srgb, var(--violet) 45%, transparent); }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 8px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; z-index: 10; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 600; }

/* Hero */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 20px 0; }
.mono {
  font: 600 1.5rem/1 var(--display); color: var(--violet); text-decoration: none;
  width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); transition: transform .5s var(--ease), border-color .2s;
}
.mono:hover { transform: rotate(-12deg) scale(1.06); border-color: var(--violet); }
.topbar-actions { display: flex; gap: 8px; }
.chip {
  font: 500 .9rem/1 var(--body); color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 16px; height: 42px; display: inline-flex; align-items: center;
  text-decoration: none; cursor: pointer; transition: border-color .2s, transform .3s var(--ease);
}
.chip.icon { width: 42px; padding: 0; justify-content: center; }
.chip:hover { border-color: var(--violet); }
.chip:active, .btn:active { transform: scale(.96); }
.chip.icon svg { transition: transform .6s var(--ease); }
.chip.icon:hover svg { transform: rotate(180deg); }
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: clamp(16px, 4vw, 48px); align-items: center; padding: clamp(12px, 3vw, 36px) 0 clamp(28px, 5vw, 56px); }
.eyebrow { font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); font-weight: 500; }
h1 { font: 700 clamp(2.5rem, 1.4rem + 5.6vw, 5rem)/1.02 var(--display); letter-spacing: -.025em; margin: 12px 0 20px; text-wrap: balance; }
.tagline { font-size: clamp(1.08rem, 1rem + .5vw, 1.3rem); color: var(--muted); max-width: 34em; text-wrap: pretty; }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none;
  font-weight: 500; font-size: .95rem;
  transition: border-color .2s, background-color .2s, transform .35s var(--ease), box-shadow .35s var(--ease);
}
.btn:hover { border-color: var(--violet); transform: translateY(-2px); box-shadow: 0 10px 24px -14px var(--violet); }
.btn.primary { background: var(--violet-deep); border-color: var(--violet-deep); color: var(--on-accent); }
.btn.primary:hover { background: var(--violet); border-color: var(--violet); }
.btn svg { transition: transform .35s var(--ease); }
.btn:hover svg:last-child { transform: translate(2px, -2px); }
.julia { width: clamp(200px, 26vw, 320px); aspect-ratio: 1; height: auto; cursor: crosshair; touch-action: pan-y; }

/* The hero eases in once on load. */
.js .hero-grid > div > *, .js .julia { animation: rise .8s var(--ease) both; }
.js .hero-grid h1 { animation-delay: 60ms; }
.js .hero-grid .tagline { animation-delay: 120ms; }
.js .hero-grid .links { animation-delay: 180ms; }
.js .julia { animation-name: bloom; animation-duration: 1.2s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes bloom { from { opacity: 0; transform: scale(.86); } }

/* Tabs: frosted sticky bar with a pill that slides to the active tab. */
.tabs {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 4px; padding: 10px 0; margin-bottom: clamp(20px, 3vw, 32px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  position: relative; z-index: 1; padding: 8px 18px; border-radius: 999px; color: var(--muted);
  text-decoration: none; font-weight: 500; white-space: nowrap; transition: color .25s;
}
.tabs a:hover, .tabs a.active { color: var(--text); }
.tab-pill {
  position: absolute; z-index: 0; top: 10px; left: 0; height: calc(100% - 20px); width: var(--pill-w, 0px);
  transform: translateX(var(--pill-x, 0px)); border-radius: 999px; opacity: 0;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--violet);
}
.tab-pill.ready { opacity: 1; transition: transform .5s var(--ease), width .5s var(--ease); }

/* Panels: without JS every section shows, with JS only the active one. */
.panel { padding-bottom: clamp(40px, 6vw, 72px); scroll-margin-top: 76px; }
.panel-title { font: 600 1.6rem/1.2 var(--display); margin-bottom: 20px; }
.js .panel { display: none; }
.js .panel.active { display: block; }
.js .panel-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
/* Items of the active panel rise in, one after another. */
.js .panel.active :is(.prose, .stats > li, .block, .job, .card, .poetry-intro, .poem-nav, .poem.active) {
  animation: rise .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms);
}
:is(.stats > li, .job, .card, .block):nth-child(2) { --i: 1; }
:is(.stats > li, .job, .card, .block):nth-child(3) { --i: 2; }
:is(.stats > li, .job, .card, .block):nth-child(4) { --i: 3; }
:is(.stats > li, .job, .card, .block):nth-child(5) { --i: 4; }
:is(.stats > li, .job, .card, .block):nth-child(6) { --i: 5; }
:is(.stats > li, .job, .card, .block):nth-child(n + 7) { --i: 6; }

.block, .card, .stats li, .poem {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color .3s, transform .45s var(--ease), box-shadow .45s var(--ease);
}
/* Soft violet light that follows the pointer across a surface (--mx/--my set in main.js). */
.block::after, .card::after, .stats li::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(26rem circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--violet) 15%, transparent), transparent 62%);
}
@media (hover: hover) {
  :is(.block, .card, .stats li):hover { border-color: color-mix(in srgb, var(--violet) 55%, var(--line)); }
  :is(.block, .card, .stats li):hover::after { opacity: 1; }
  :is(.card, .stats li):hover { transform: translateY(-3px); box-shadow: 0 18px 40px -28px var(--violet); }
}
.block { padding: clamp(18px, 2.4vw, 26px); }
.block h2, .skill-groups h2 { font: 600 .8rem/1.3 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 12px; }
.block h2.gap { margin-top: 26px; }

/* About */
.prose { display: grid; gap: 14px; font-size: 1.08em; max-width: 46em; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--gap); margin: clamp(22px, 3vw, 32px) 0; }
.stats li { padding: 20px; display: grid; gap: 6px; align-content: start; }
.stats strong { font: 700 clamp(1.5rem, 1.2rem + 1vw, 1.9rem)/1.15 var(--display); color: var(--accent-text); }
.stats span { font-size: .85rem; color: var(--muted); line-height: 1.45; }
.math { border-left: 3px solid var(--violet); margin-bottom: var(--gap); }
.math .card-links { margin-top: 14px; position: relative; z-index: 1; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--gap); }
.plain { display: grid; gap: 12px; }
.ticks { display: grid; gap: 10px; }
.ticks li { padding-left: 22px; position: relative; }
.ticks li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 50%; background: var(--violet); }

/* Experience */
.timeline { position: relative; border-left: 1px solid var(--line); margin-left: 6px; display: grid; gap: clamp(28px, 4vw, 44px); }
.job { padding-left: clamp(20px, 3vw, 30px); position: relative; }
.job::before { content: ''; position: absolute; left: -6px; top: 9px; width: 11px; height: 11px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 4px var(--bg); }
.job h2 { font: 600 clamp(1.35rem, 1.2rem + .6vw, 1.65rem)/1.2 var(--display); }
.job-role { font-weight: 500; margin-top: 2px; }
.group { margin-top: 18px; }
.group h3 { font: 600 1rem/1.4 var(--body); margin-bottom: 8px; }
.group h3 .muted { font-weight: 400; font-size: .85rem; margin-left: 6px; white-space: nowrap; }
.group ul { display: grid; gap: 8px; }
.group li { padding-left: 18px; position: relative; }
.group li::before { content: ''; position: absolute; left: 2px; top: .75em; width: 6px; height: 1.5px; background: var(--violet); }

/* Projects */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: var(--gap); }
.card { overflow: hidden; display: flex; flex-direction: column; }
.card.featured { grid-column: 1 / -1; flex-direction: row; }
.card.featured img { width: 46%; object-fit: cover; height: auto; min-height: 100%; transition: transform 1.2s var(--ease); }
.card.featured:hover img { transform: scale(1.04); }
.card-body { padding: clamp(18px, 2.4vw, 26px); display: flex; flex-direction: column; gap: 10px; flex: 1; position: relative; z-index: 1; }
.card h2 { font: 600 1.25rem/1.25 var(--display); }
.card.featured h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); }
.card-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.tags.big li { font-size: .92rem; padding: 6px 12px; color: var(--text); transition: border-color .2s, transform .3s var(--ease); }
.tags.big li:hover { border-color: var(--violet); transform: translateY(-2px); }

/* Skills */
.skill-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: var(--gap); }
.langs { display: grid; gap: 8px; }
.langs li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.langs li:last-child { border: 0; padding: 0; }

/* Poetry: list of poems beside a reading pane. */
.poetry-intro { color: var(--muted); max-width: 40em; margin-bottom: clamp(18px, 3vw, 28px); font-size: 1.05em; }
.poetry { display: grid; grid-template-columns: minmax(200px, 270px) minmax(0, 1fr); gap: clamp(16px, 3vw, 40px); align-items: start; }
.poem-nav { position: sticky; top: 78px; display: grid; gap: 4px; max-height: calc(100vh - 100px); overflow-y: auto; scrollbar-width: thin; padding: 2px; }
.poem-nav a {
  display: grid; gap: 2px; padding: 10px 14px; border-radius: 14px; text-decoration: none; color: var(--muted);
  border: 1px solid transparent; transition: background-color .25s, border-color .25s, box-shadow .35s var(--ease), transform .35s var(--ease);
}
.poem-nav a:hover { transform: translateX(3px); }
.poem-nav .t { font: 600 1rem/1.3 var(--display); color: var(--text); }
.poem-nav .f { font: italic 400 .86rem/1.4 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poem-nav a.active { background: var(--surface); border-color: var(--line); box-shadow: inset 3px 0 0 var(--violet); }
.poem-stage { scroll-margin-top: 92px; min-width: 0; }
.poem { padding: clamp(22px, 4.5vw, 52px); scroll-margin-top: 92px; }
.poem + .poem { margin-top: var(--gap); }
.poem h3 { font: 600 clamp(1.5rem, 1.2rem + 1.4vw, 2.2rem)/1.15 var(--display); letter-spacing: -.01em; margin-bottom: 1.1em; text-wrap: balance; }
.poem h3.untitled { color: var(--muted); font-style: italic; font-weight: 500; }
.poem h3::after { content: ''; display: block; width: 44px; height: 3px; border-radius: 3px; background: var(--violet); margin-top: .6em; }
.stanza { font: 400 clamp(1.08rem, 1rem + .35vw, 1.22rem)/1.95 var(--serif); margin-bottom: 1.5em; }
.poem:lang(mr) .stanza { line-height: 2.1; }
.line { display: block; padding-left: 1.4em; text-indent: -1.4em; } /* wrapped lines hang */
.poem-next { margin-top: 2.2em; padding-top: 1.4em; border-top: 1px solid var(--line); }
.js .poem { display: none; }
.js .poem.active { display: block; margin-top: 0; }

footer { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted); font-size: .85rem; }
.notfound { min-height: 100vh; display: grid; align-content: center; justify-items: start; }

/* Scroll-linked touches, only where the browser supports them. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    /* The Julia set drifts back as the page scrolls. */
    .js .julia {
      animation: bloom 1.2s var(--ease) both, recede linear both;
      animation-timeline: auto, scroll(root); animation-range: normal, 0 520px;
    }
    /* A violet line fills the timeline as it passes through the viewport. */
    .timeline::before {
      content: ''; position: absolute; left: -1.5px; top: 0; bottom: 0; width: 2px; border-radius: 2px;
      background: linear-gradient(var(--violet), var(--violet-hi)); transform-origin: top;
      animation: fill linear both; animation-timeline: view(); animation-range: cover 8% cover 92%;
    }
  }
}
@keyframes recede { to { opacity: .18; translate: 0 70px; scale: 1.12; rotate: 10deg; } }
@keyframes fill { from { transform: scaleY(0); } }

@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; }
  .julia { width: 170px; order: -1; margin: -10px 0 -14px -14px; }
  .card.featured { flex-direction: column; }
  .card.featured img { width: 100%; min-height: 0; aspect-ratio: 1200 / 630; }
  .links .btn { font-size: .9rem; }
  .tabs { margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .tab-pill { left: var(--gutter); }
  .poetry { grid-template-columns: minmax(0, 1fr); }
  .poem-nav {
    position: static; display: flex; gap: 8px; max-height: none; overflow-x: auto; scroll-snap-type: x proximity;
    margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter) 8px; scrollbar-width: none;
  }
  .poem-nav::-webkit-scrollbar { display: none; }
  .poem-nav a { flex: 0 0 auto; width: 190px; scroll-snap-align: center; background: var(--surface); border-color: var(--line); }
  .poem-nav a:hover { transform: none; }
  .poem-nav a.active { box-shadow: inset 0 -3px 0 var(--violet); }
}
@media (prefers-reduced-motion: reduce) {
  *, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; }
}
