/* Home page layout. The design system (tokens, buttons, bands, tints, waves,
 * reveal on scroll) is in portfolio.css; this file adds the hero, its
 * illustration, the tool cards, the bento of uses and the closing band.
 * Section spacing: 96 px, 64 on phones. */

/* The hero sits on the cream page; lavender stays a soft shape behind the illustration. */
.hero { position: relative; overflow: hidden; padding: 80px 0 96px; color: var(--fg); }
.hero-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero-lines path { fill: none; stroke: light-dark(var(--mskrz-lavender), #2a2342); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr); gap: 56px; align-items: center; }
.hero h1 {
  margin: 0; font-size: clamp(40px, 6vw, 72px); line-height: .98;
  letter-spacing: -0.04em; font-weight: 850;
}
.h1-soft, .h1-line { display: block; }
.h1-soft, .h1-soft-word { color: var(--band-soft); }
.hero .lede { color: var(--dim); max-width: 46ch; margin-top: 26px; }
.hero .actions { margin-top: 32px; }

/* ------------------------------------------------------ hero collage */

.collage { position: relative; isolation: isolate; min-width: 0; padding-bottom: 270px; }
.collage::before {
  content: ""; position: absolute; z-index: -1; inset: 10% -4% 4% 8%;
  border-radius: 36px; background: var(--band);
}
.mock {
  background: var(--surface); color: var(--fg); border: 1px solid var(--violet-edge);
  border-radius: 14px; box-shadow: 0 3px 0 var(--violet-edge); overflow: hidden;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
}
.mock-title {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  font: 650 13px/1.4 system-ui, sans-serif; color: var(--fg);
  background: var(--violet-bg); border-bottom: 1px solid var(--violet-edge);
}
.mock-title img { width: 18px; height: 18px; border-radius: 4px; flex: none; }
.popup .mock-title { background: var(--mint-bg); border-color: var(--mint-edge); }
.mock-bar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-family: system-ui, sans-serif; }
.mock-label { color: var(--dim); }
.mock-select { padding: 1px 8px; border: 1px solid var(--line); border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mock-tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); font-family: system-ui, sans-serif; }
.mock-tabs button {
  appearance: none; margin: 0; padding: 6px 10px; border: 0; border-radius: 6px 6px 0 0; background: none;
  font: inherit; color: var(--dim); cursor: pointer;
}
.mock-tabs button:hover { color: var(--fg); background: var(--surface-2); }
.mock-tabs button[aria-selected="true"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); background: none; }
.mock-tabs button:disabled { cursor: default; }
.mock-tabs button:disabled:hover { color: var(--dim); background: none; }
.mock-tabs button:disabled[aria-selected="true"]:hover { color: var(--accent); }
.demo-tag { margin-left: auto; padding: 0 8px; border: 1px solid var(--violet-edge); border-radius: 999px; font: 600 11px/1.6 system-ui, sans-serif; color: var(--dim); background: var(--surface); }
.popup .demo-tag { border-color: var(--mint-edge); }

/* The three views share one height, so switching does not move the window. */
.mock-view { display: flex; flex-direction: column; min-height: calc(11 * 1.7em + 20px + 33px); }
.mock-view[hidden] { display: none; }
.mock-view > :first-child { flex: 1; }
.tree { list-style: none; margin: 0; padding: 10px 0; counter-reset: line; }
.tree li { padding: 0 14px 0 44px; position: relative; white-space: nowrap; color: light-dark(#7a2e8f, #e0a8f0); }
.tree li::before { counter-increment: line; content: counter(line); position: absolute; left: 0; width: 28px; text-align: right; color: var(--dim); opacity: .6; }
.tree i { font-style: normal; color: var(--dim); }
.tree s { text-decoration: none; color: light-dark(#13723f, #7fd8a4); }
.tree b { font-weight: 400; color: light-dark(#1d4ed8, #93b4ff); }
.tree .d1 { padding-left: 58px; }
.tree .d2 { padding-left: 72px; }
.tree .changed { background: light-dark(#fdf1c4, #3a3112); }
.mock-status { display: flex; align-items: center; gap: 10px; min-height: 33px; padding: 4px 12px; border-top: 1px solid var(--line); color: var(--dim); font-family: system-ui, sans-serif; font-size: 12px; }
.mock-act {
  appearance: none; margin: 0; padding: 0 10px; border: 1px solid var(--violet-edge); border-radius: 6px; background: var(--violet-bg);
  font: 600 12px/1.8 system-ui, sans-serif; color: var(--fg); cursor: pointer;
}
.mock-act:hover { background: var(--accent-soft); border-color: var(--accent); }
.mock-act:disabled { cursor: default; }
.mock-act:disabled:hover { background: var(--violet-bg); border-color: var(--violet-edge); }

/* Data: the changed row keeps a soft amber and flashes when its value changes. */
.tree .changed.pulse, .motion .collage[data-seq] .tree .changed.pulse { animation: flash 1600ms ease-out; opacity: 1; }

/* Structure: a few elements; the hidden one explains itself on hover or focus. */
.struct { list-style: none; margin: 0; padding: 10px 0; }
.struct li { position: relative; padding: 0 14px 0 14px; white-space: nowrap; }
.struct li.s1 { padding-left: 38px; }
.struct i { font-style: normal; color: var(--dim); }
.et { font-family: system-ui, sans-serif; font-size: 11.5px; color: var(--dim); margin-right: 4px; }
.rule-btn {
  appearance: none; display: inline-flex; align-items: center; gap: 0; margin: 1px -6px; padding: 0 6px; border: 0; border-radius: 6px; background: none;
  font: inherit; color: inherit; cursor: help; text-align: left;
}
.rule-btn:hover, .hidden-field[data-show] .rule-btn { background: var(--warn-soft); }
.rule-btn .pill { margin-left: 8px; }
.rule-card {
  position: absolute; z-index: 3; top: 100%; left: 38px; width: min(250px, calc(100% - 52px)); padding: 10px 12px; white-space: normal;
  background: var(--surface); border: 1px solid var(--amber-edge); border-radius: 10px; box-shadow: 0 3px 0 var(--amber-edge), 0 12px 28px light-dark(rgb(32 33 43 / 16%), rgb(0 0 0 / 50%));
  font: 12.5px/1.5 system-ui, sans-serif; visibility: hidden; opacity: 0; translate: 0 -4px;
  transition: opacity 160ms var(--ease-out), translate 160ms var(--ease-out), visibility 0s linear 160ms;
}
.hidden-field[data-show] .rule-card { visibility: visible; opacity: 1; translate: 0 0; transition-delay: 0s; }
.rule-head { display: block; font-size: 11.5px; font-weight: 650; color: var(--warn); }
.rule-card code { display: inline-block; margin: 2px 0 4px; padding: 0 6px; border: 1px solid var(--amber-edge); border-radius: 5px; background: var(--amber-bg); font-size: 12px; }
.rule-card p { margin: 0; color: var(--fg); }

/* Calls: the failed call opens to show where the error is. */
.call-list { list-style: none; margin: 0; padding: 8px; display: grid; gap: 4px; align-content: start; }
.call-list li { border-radius: 8px; }
.call-list li > .kind, .call-btn .kind { flex: none; }
.call-list li:not(.bad) { display: flex; align-items: center; gap: 8px; padding: 4px 8px; }
.call-list li.bad { background: light-dark(#fdecea, #2e1515); }
.call-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-list .ok, .call-list .err { font: 650 11.5px/1.6 system-ui, sans-serif; white-space: nowrap; }
.call-list .ok { color: var(--ok); }
.call-list .err { color: light-dark(#b42318, #ff9b8f); }
.call-btn {
  appearance: none; display: flex; align-items: center; gap: 8px; width: 100%; margin: 0; padding: 4px 8px; border: 0; border-radius: 8px; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.call-btn:hover { background: light-dark(rgb(180 35 24 / 8%), rgb(255 155 143 / 10%)); }
.chev { flex: none; width: 7px; height: 7px; margin: 0 2px 2px 2px; border: solid var(--dim); border-width: 0 1.5px 1.5px 0; rotate: 45deg; transition: rotate 160ms var(--ease-out); }
.call-btn[aria-expanded="true"] .chev { rotate: 225deg; margin-bottom: -2px; }
.call-error { padding: 2px 10px 10px; font-family: system-ui, sans-serif; }
.call-error p { margin: 0 0 6px; color: var(--fg); }
.call-error pre { margin: 0; padding: 6px 8px; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.call-error code { padding: 0; border: 0; background: none; font-size: 12px; color: light-dark(#b42318, #ff9b8f); }

.popup {
  position: absolute; right: -24px; bottom: 0; width: 284px;
  border-color: var(--mint-edge); box-shadow: 0 3px 0 var(--mint-edge), 0 18px 40px light-dark(rgb(32 33 43 / 14%), rgb(0 0 0 / 45%));
}
.mock-search { margin: 10px; border: 1px solid var(--accent); border-radius: 8px; }
.mock-search:focus-within { outline: 2px solid var(--emphasis); outline-offset: 2px; }
.mock-search input {
  display: block; width: 100%; min-height: 30px; margin: 0; padding: 4px 10px; border: 0; border-radius: 8px; background: none; outline: 0;
  font: inherit; color: var(--fg);
}
.mock-search input::placeholder { color: var(--dim); opacity: 1; }
.finds { list-style: none; margin: 0; padding: 0; font-family: system-ui, sans-serif; }
.finds li { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; padding: 8px 12px; border-top: 1px solid var(--line); }
.finds li.first { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.finds li[hidden] { display: none; }
.finds li:not(.first) .vchips { display: none; }
.finds li.opening { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.finds-status { margin: 0; padding: 6px 12px; border-top: 1px solid var(--line); font: 12px/1.6 system-ui, sans-serif; color: var(--dim); }
.finds-status.opening { color: var(--accent); font-weight: 650; }
.finds small { grid-column: 2; color: var(--dim); font-size: 12px; }
.finds .vchips { grid-column: 2; margin-top: 4px; }

.kind { margin: 0; display: inline-grid; place-items: center; min-width: 24px; height: 18px; padding: 0 4px; border-radius: 4px; font: 700 10.5px/1 var(--mono); }
.kind.os { background: var(--amber-bg); color: var(--warn); }
.kind.ip { background: var(--sky-bg); color: light-dark(#1f4f8f, #9cc0f0); }
.kind.dm { background: var(--mint-bg); color: var(--ok); }
.kind.fc { background: var(--violet-bg); color: var(--accent); }
.kind.ra { background: var(--rose-bg); color: light-dark(#9a3412, #f2a58e); }

.vchips { display: flex; flex-wrap: wrap; gap: 4px; }
.vchips span { padding: 0 7px; border: 1px solid var(--line); border-radius: 5px; font: 12px/1.7 var(--mono); color: var(--dim); }
.vchips .active { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.vchips .active::after { content: " ●"; font-size: 8px; vertical-align: 2px; }

/* -------------------------------------------------------------- points */

.points { border-bottom: 1px solid var(--line); }
.points-row { list-style: none; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; padding-top: 36px; padding-bottom: 36px; }
.points li { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: start; }
.points b { font-size: 16px; }
.points li > span:last-child { grid-column: 2; color: var(--dim); font-size: 15px; }
.point-icon { grid-row: span 2; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--violet-bg); border: 1px solid var(--violet-edge); color: var(--accent); }

/* --------------------------------------------------------------- tools */

.home .tools { padding: 96px 0 72px; }
.home .tools .display { margin-bottom: 36px; }
.home .extension-grid { gap: 24px; }
.home .extension-card { border-radius: 16px; padding: clamp(20px, 3vw, 32px); }
.home .extension-card .badge { background: var(--surface); border-color: var(--tint-edge); }
.home .extension-card .extension-thumbnail { height: 168px; background: var(--surface); border: 1px solid var(--tint-edge); border-radius: 10px; }
.home .extension-card .extension-thumbnail img { transition: scale 300ms var(--ease-out); transform-origin: top center; }
.home .extension-card:hover .extension-thumbnail img { scale: 1.03; }

/* ---------------------------------------------------------------- uses */

.uses { padding: 72px 0 112px; border-top: 1px solid var(--line); }
.uses-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 32px; margin-bottom: 36px; }
.uses-head p { margin: 0; color: var(--dim); font-size: 17px; }

.bento { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px; }
.use { grid-column: span 2; display: grid; grid-template-rows: auto 1fr; border-radius: 16px; overflow: hidden; }
.use.wide { grid-column: span 3; grid-template-rows: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.illo { display: grid; place-items: center; padding: 24px 20px; min-height: 168px; border-bottom: 1px solid var(--tint-edge); background: color-mix(in srgb, var(--tint-edge) 22%, var(--tint-bg)); }
.use.wide .illo { border-bottom: 0; border-right: 1px solid var(--tint-edge); }
.use-text { padding: 22px 24px 26px; }
.use-tool { display: inline-block; font-size: 12.5px; font-weight: 650; letter-spacing: .02em; color: var(--dim); }
.use h3 { margin: 4px 0 8px; font-size: 20px; line-height: 1.2; letter-spacing: -0.015em; }
.use p { margin: 0; color: var(--dim); font-size: 15px; }
.use p code { background: var(--surface); border-color: var(--tint-edge); }

/* The small drawings inside the bento cards. */
.mini {
  display: grid; gap: 6px; width: min(100%, 250px); padding: 12px; margin: 0;
  background: var(--surface); border: 1px solid var(--tint-edge); border-radius: 12px;
  box-shadow: 0 2px 0 var(--tint-edge); list-style: none;
  transition: scale 300ms var(--ease-out);
}
.use:hover .mini { scale: 1.03; }
.mini .line { display: block; padding: 2px 8px; border: 0; border-radius: 5px; background: transparent; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .line.flash { background: light-dark(#fdf1c4, #3a3112); }
.mini .line.now { color: var(--warn); }
.mini .line.rule span { display: block; font-family: system-ui, sans-serif; font-size: 11.5px; color: var(--dim); }
.seg { display: flex; gap: 2px; padding: 2px; border-radius: 7px; background: var(--surface-2); font-size: 12px; justify-self: start; }
.seg span { padding: 1px 9px; border-radius: 5px; color: var(--dim); }
.seg .on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgb(16 24 40 / 14%); }
.field { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.pill { font-size: 11.5px; font-weight: 650; padding: 0 8px; border-radius: 999px; }
.pill.off { background: var(--warn-soft); color: var(--warn); }
.calls li { display: flex; align-items: center; gap: 8px; font: 12px/1.6 var(--mono); padding: 3px 4px; border-radius: 6px; }
.calls li > :last-child { margin-left: auto; font-family: system-ui, sans-serif; font-size: 11.5px; font-weight: 650; }
.calls .ok { color: var(--ok); }
.calls .err { color: light-dark(#b42318, #ff9b8f); }
.calls .bad { background: light-dark(#fdecea, #2e1515); }
.mini-search { padding: 4px 8px; border: 1px solid var(--accent); border-radius: 7px; font: 12px/1.6 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hit { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 6px; border-radius: 6px; }
.hit:not(.dim) { background: var(--accent-soft); }
.hit.dim { color: var(--dim); }
.open-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: 13px; }
.open-btn { padding: 1px 10px; border: 1px solid var(--line); border-radius: 6px; font: 12px/1.7 var(--mono); }

/* The lavender wave follows the ink wave's shape one ribbon lower, so only a
 * thin, even strip of page shows between the two bands. */
.home .wave-band { margin-top: -14px; }

/* ------------------------------------------------------------- closing */

.closing { padding: 40px 0 96px; }
.closing p { margin: 18px 0 0; max-width: 56ch; font-size: 17px; }
/* The coffee line closes the band, centred under the tool tiles. */
.closing .coffee-line { margin: 20px auto 0; font-size: 15px; color: var(--band-soft); text-align: center; }
.closing-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; align-items: center; }

/* One tile per tool, each with the button that adds it. */
.add-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 250px); gap: 20px; }
.add-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 22px; color: var(--fg); }
.add-tile img { width: 64px; height: 64px; border-radius: 14px; margin-bottom: 8px; }
.add-tile h3 { margin: 0; font-size: 18px; line-height: 1.25; letter-spacing: -0.015em; }
.closing .add-where { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; color: var(--dim); font-size: 14px; }
.add-where .action-icon { width: 15px; height: 15px; }
.add-tile .btn { margin-top: auto; }
@media (max-width: 960px) { .closing-row { grid-template-columns: 1fr; gap: 32px; } }
@media (max-width: 560px) { .add-tiles { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ narrower */

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .popup { right: 0; }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .use, .use.wide { grid-column: span 1; grid-template-columns: none; grid-template-rows: auto 1fr; }
  .use.wide .illo { border-right: 0; border-bottom: 1px solid var(--tint-edge); }
  .bento > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .points-row { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 600px) {
  .hero { padding: 48px 0 56px; }
  .collage { padding-bottom: 0; }
  .popup { position: relative; right: auto; width: auto; margin: 20px 0 0; }
  .mock-search input { font-size: 16px; }
  .home .tools { padding: 64px 0 48px; }
  .uses { padding: 48px 0 72px; }
  .bento { grid-template-columns: 1fr; gap: 16px; }
  .bento > :last-child { grid-column: auto; }
  .home .wave-band { margin-top: -8px; }
  .closing { padding: 32px 0 64px; }
}

/* -------------------------------------------------------------- motion */

.bento > :nth-child(2), .bento > :nth-child(4) { --delay: 80ms; }
.bento > :nth-child(5) { --delay: 160ms; }

/* The hero windows fill in part by part (data-part, in portfolio.css). The
 * value changes, the typing and the filter are in assets/hero-demo.js. */
.motion .collage[data-seq].settled [data-part] { opacity: 1; animation: none; }
@keyframes flash { 0%, 40% { background: light-dark(#fbd96a, #6b5410); } }
.motion .use.in .flash { animation: part-in 520ms var(--ease-out) var(--at) both, flash 1600ms ease-out 500ms backwards; }

@media (prefers-reduced-motion: reduce) {
  .mini, .home .extension-card .extension-thumbnail img, .rule-card, .chev { transition: none; }
  .tree .changed.pulse { animation: none; }
  .use:hover .mini, .home .extension-card:hover .extension-thumbnail img { scale: none; }
}
