/* Leo Souza portfolio v3: Rachel's structure and type, Ryo's desktop and mono chrome,
   one concrete-and-vermilion palette. Shared by every page.
   One accent, sharp corners, one 12-column grid. Fonts load from Google Fonts for the
   prototype; self-host before launch. */

:root {
  --ground: #E4E4E0;
  --ink: #141414;
  --muted: #55554F;
  --hair: rgb(20 20 20 / 0.22);
  --accent: #B92B16;

  /* Objects (cassettes, paper, tiles) keep their own colours in both themes. */
  --paper: #F2F1EA;
  --paper-ink: #141414;
  --tape-vermilion: #D4351C;
  --tape-ink: #141414;
  --tape-bone: #D2D1C8;
  --tape-grey: #7A7A74;

  --font-serif: "Newsreader", "Zen Kaku Gothic New", Georgia, serif;
  --font-sans: "Archivo", "Zen Kaku Gothic New", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-hand: "Reenie Beanie", "Zen Kaku Gothic New", cursive;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --gutter: 24px;
  --mb-h: 48px;

  color-scheme: light;
  interpolate-size: allow-keywords;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #121211; --ink: #E9E9E4; --muted: #A3A39B;
    --hair: rgb(233 233 228 / 0.22); --accent: #FF6B4A; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #121211; --ink: #E9E9E4; --muted: #A3A39B;
  --hair: rgb(233 233 228 / 0.22); --accent: #FF6B4A; color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--mb-h) + 16px); }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font-sans); font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

/* Concrete tooth: fixed, non-interactive, never on a scrolling container. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
:root[data-theme="dark"] body::before { opacity: 0.12; mix-blend-mode: screen; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::before { opacity: 0.12; mix-blend-mode: screen; }
}

a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button { font: inherit; color: inherit; }

.wrap { max-width: 1360px; margin-inline: auto; padding-inline: clamp(16px, 3vw, 40px); }
.grid12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }
.mono { font-family: var(--font-mono); }
.hand { font-family: var(--font-hand); }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 90; background: var(--ink); color: var(--ground);
  padding: 0 14px; min-height: 44px; display: inline-flex; align-items: center; font: 500 0.8125rem var(--font-mono);
}
.skip:focus { top: 12px; color: var(--ground); }

/* Underline that draws in (Rachel's links) */
.u { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 220ms var(--ease-out), color 120ms ease; padding-bottom: 2px; }
@media (hover: hover) { .u:hover { background-size: 100% 1px; } }
.linkbtn { appearance: none; background-color: transparent; border: 0; padding: 0 0 2px; cursor: pointer; font: 500 0.8125rem/1.4 var(--font-mono); color: inherit; }

/* ---------- Menubar ---------- */
.menubar { position: sticky; top: 0; z-index: 60; background: var(--ground); border-bottom: 1px solid var(--ink); view-transition-name: menubar; }
.mb-row { height: var(--mb-h); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.mb-left { display: flex; align-items: center; gap: 36px; min-width: 0; }
.mb-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font: 600 0.9375rem/1 var(--font-mono); white-space: nowrap; min-height: 44px; }
.mb-brand:hover { color: inherit; }
/* The kanji is part of the name, so it is set larger, heavier and in full ink. */
.mb-brand .ja { font-family: "Zen Kaku Gothic New", var(--font-sans); font-weight: 700; font-size: 1.3125rem; line-height: 1; letter-spacing: 0.12em; color: var(--ink); }
.mb-nav ul { display: flex; align-items: center; gap: 26px; list-style: none; margin: 0; padding: 0; }
.mb-nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font: 500 0.875rem/1 var(--font-mono); }
.mb-nav a[aria-current="page"] { color: var(--accent); }
.roll-in { display: block; height: 1.25em; line-height: 1.25; overflow: hidden; }
.roll-in > span { display: block; transition: transform 220ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .mb-nav a:hover .roll-in > span { transform: translateY(-100%); }
  .mb-nav a:hover { color: var(--accent); }
}
.mb-right { display: flex; align-items: center; gap: 16px; font: 500 0.75rem/1 var(--font-mono); }
.mb-btn { background: transparent; border: 0; cursor: pointer; min-height: 44px; padding: 0 4px; font: 500 0.75rem/1 var(--font-mono); color: var(--muted); transition: color 120ms ease, transform 160ms var(--ease-out); }
.mb-btn:hover { color: var(--ink); }
.mb-btn:active { transform: scale(0.97); }
.mb-disc { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; font-size: 1.375rem; color: var(--muted); transition: color 120ms ease, transform 160ms var(--ease-out); }
.mb-disc:hover { color: var(--accent); }
.mb-disc:active { transform: scale(0.94); }
.mb-disc { position: relative; background: transparent; border: 0; cursor: pointer; padding: 0; }
.mb-disc[aria-expanded="true"] { color: var(--ink); }
.mb-disc.is-playing::after { content: ""; position: absolute; top: 9px; right: 8px; width: 6px; height: 6px; background: var(--accent); }
@media (prefers-reduced-motion: no-preference) { .mb-disc.is-playing::after { animation: disc-pulse 1.6s ease-in-out infinite; } }
@keyframes disc-pulse { 50% { opacity: 0.35; } }
.mb-disc svg { width: 1em; height: 1em; display: block; }
.mb-contact { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--ink); text-decoration: none; transition: background-color 120ms ease, color 120ms ease, transform 160ms var(--ease-out); }
.mb-contact:hover { background: var(--ink); color: var(--ground); }
.mb-contact:active { transform: scale(0.97); }

/* ---------- Fun sticks out: a vermilion cassette chip in the nav (static) ---------- */
.mb-nav a.k7-link, .k7-link {
  position: relative; display: inline-flex; align-items: center; gap: 9px; min-height: 36px; padding: 0 14px 0 10px;
  border: 1.5px solid var(--accent); color: var(--accent); font: 700 0.875rem/1 var(--font-mono); text-decoration: none;
  background: transparent; transition: background-color 140ms ease, color 140ms ease, transform 160ms var(--ease-out);
}
.k7-deck { display: inline-grid; place-items: center; }
.k7-ico { font-size: 1.375rem; line-height: 1; }
.mb-nav a.k7-link:hover, .k7-link:hover { background: var(--accent); color: var(--ground); }
.mb-nav a.k7-link[aria-current="page"] { background: var(--accent); color: var(--ground); }
.k7-link:active { transform: scale(0.97); }

/* ---------- Cursor chip (the native cursor stays) ---------- */
.cursor-chip {
  position: fixed; left: 0; top: 0; z-index: 420; pointer-events: none; opacity: 0;
  font: 500 0.6875rem/1 var(--font-mono); letter-spacing: 0.04em; background: var(--ink); color: var(--ground);
  padding: 6px 8px; transition: opacity 120ms ease; white-space: nowrap;
}
.cursor-chip.is-on { opacity: 1; }
@media (hover: none), (pointer: coarse) { .cursor-chip { display: none; } }

/* ---------- Hover explanations (tooltips) ---------- */
.tip {
  position: fixed; left: 0; top: 0; z-index: 410; max-width: 264px; padding: 10px 12px; pointer-events: none;
  background: var(--paper); color: #141414; border: 1px solid #141414; box-shadow: 3px 3px 0 #141414;
  font: 400 0.8125rem/1.45 var(--font-sans); opacity: 0; transform: translateY(4px);
  transition: opacity 120ms ease, transform 160ms var(--ease-out);
}
.tip.is-on { opacity: 1; transform: none; }
.tip[hidden] { display: none; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(40px, 6.5vw, 84px) clamp(32px, 4.5vw, 56px); }
.hero-role { grid-column: 1 / -1; margin: 0 0 22px; font: 500 0.75rem/1.4 var(--font-mono); letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.hero h1 {
  grid-column: 1 / -1; margin: 0; max-width: 15em; text-wrap: balance;
  font: 450 clamp(2.5rem, 6.6vw, 6rem)/0.98 var(--font-serif); letter-spacing: -0.028em; font-optical-sizing: auto;
}

/* ---------- Two-column body: tiles and rail ---------- */
/* Home title: a plain sentence with the name as its subject, set modestly, with a quiet two-column line beneath. */
.hero--home { padding-block: clamp(48px, 7vw, 96px) clamp(40px, 5vw, 64px); }
.hero--home h1 { max-width: 19em; font: 400 clamp(2rem, 4.5vw, 4rem)/1.12 var(--font-serif); letter-spacing: -0.03em; }

.layout { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: start; }
.rail { grid-column: 1 / 4; grid-row: 1; position: sticky; top: calc(var(--mb-h) + 28px); }
.rail dl { margin: 0; }
.rail dt { font: 500 0.6875rem/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.rail dd { margin: 0 0 24px; font-size: 0.9375rem; line-height: 1.45; }
.rail ul { list-style: none; margin: 0; padding: 0; display: grid; }
.rail li { padding-block: 3px; }
.rail .links a { display: inline-flex; align-items: center; min-height: 44px; font: 500 0.8125rem/1 var(--font-mono); }
.main-col { grid-column: 4 / 13; grid-row: 1; min-width: 0; }

/* ---------- Project tiles: big media, text on hover, click to open ---------- */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(44px, 6vw, 72px); }
.tile { display: block; color: inherit; text-decoration: none; }
.tile:hover { color: inherit; }
.tile-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--ink); background: var(--t-bg); color: var(--t-fg); isolation: isolate; }
.cover { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: clamp(16px, 2.6vw, 36px); background: var(--t-bg); color: var(--t-fg); overflow: hidden; }
.cover::before { content: ""; position: absolute; inset: -24px; background-image: radial-gradient(currentColor 1px, transparent 1.5px); background-size: 24px 24px; opacity: 0.22; }
@media (prefers-reduced-motion: no-preference) { .cover::before { animation: cover-drift 9s linear infinite; } }
@keyframes cover-drift { to { transform: translate(24px, 24px); } }
.cover-name { position: relative; font: 450 clamp(3.25rem, 9.5vw, 8.5rem)/0.9 var(--font-serif); letter-spacing: -0.035em; transition: transform 320ms var(--ease-out); }
.tile-media > img, .tile-media > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 500ms ease; }
.tile-media.is-loaded > img, .tile-media.is-loaded > video { opacity: 1; }
/* Logo-only tiles: the client's mark on its own colour, one slow idle motion each. */
.mark { position: absolute; inset: 0; display: grid; place-items: center; background: var(--t-bg); overflow: hidden; }
.mark img { display: block; height: auto; max-width: none; }
.mark .logo { width: 34%; position: relative; transition: scale 360ms var(--ease-out); }
.mark--armada .logo { width: 38%; }
.mark--visa .logo { width: 24%; }
.mark--tuvis .logo { width: 22%; }
.mark .v { position: relative; width: 19%; aspect-ratio: 562 / 486; transition: scale 360ms var(--ease-out); }
.mark .v img { position: absolute; inset: 0; width: 100%; height: 100%; }
.mark .glow { position: absolute; inset: 0; background: radial-gradient(60% 70% at 78% 88%, rgba(31, 217, 255, 0.22), transparent 70%); }
.tri-wrap { position: absolute; inset: 0; -webkit-mask-image: radial-gradient(ellipse 62% 72% at 50% 50%, transparent 38%, #000 100%); mask-image: radial-gradient(ellipse 62% 72% at 50% 50%, transparent 38%, #000 100%); }
.tri { position: absolute; left: -300px; top: -260px; right: 0; bottom: 0; background: url("img/armada-triangles.svg") 0 0 / 300px 260px repeat; opacity: 0.38; }
@media (hover: hover) { .tile:hover .mark .logo, .tile:hover .mark .v { scale: 1.05; } }
@media (prefers-reduced-motion: no-preference) {
  .mark .logo, .mark .v { animation: mark-in 900ms var(--ease-out) both, mark-float 9s ease-in-out 900ms infinite; }
  .tiles li:nth-child(2) .mark .logo, .tiles li:nth-child(2) .mark .v { animation-delay: 80ms, 1100ms; }
  .tiles li:nth-child(3) .mark .logo, .tiles li:nth-child(3) .mark .v { animation-delay: 160ms, 1300ms; }
  .tiles li:nth-child(4) .mark .logo, .tiles li:nth-child(4) .mark .v { animation-delay: 240ms, 1500ms; }
  .mark .v-c { animation: chevron-slide 7s ease-in-out infinite; }
  .mark .glow { animation: glow-breathe 8s ease-in-out infinite; }
  .tri { animation: tri-drift 70s linear infinite; }
}
@keyframes mark-in { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
@keyframes mark-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes chevron-slide { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(5%, -2%); } }
@keyframes glow-breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes tri-drift { to { transform: translate(300px, 260px); } }
.tile-media > img.tile-img { opacity: 1; transition: transform 420ms var(--ease-out); }
@media (hover: hover) { .tile:hover .tile-media > img.tile-img { transform: scale(1.02); } }
.tile-over { position: absolute; inset: auto 0 0 0; z-index: 2; display: grid; gap: 8px; padding: clamp(18px, 2.4vw, 30px); background: var(--paper); color: #141414; border-top: 1px solid #141414; transform: translateY(101%); transition: transform 280ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .tile:hover .tile-over, .tile:focus-visible .tile-over { transform: none; }
  .tile:hover .cover-name { transform: translateY(-10px); }
}
@media (hover: none) { .tile-over { display: none; } }
.tile-line { margin: 0; font: 450 clamp(1.25rem, 2vw, 1.75rem)/1.2 var(--font-serif); letter-spacing: -0.012em; }
.tile-more { margin: 0; color: #3A3A36; font-size: 0.9375rem; line-height: 1.45; }
.tile-cta { margin-top: 6px; font: 600 0.75rem/1 var(--font-mono); letter-spacing: 0.07em; text-transform: uppercase; }
.tile:focus-visible { outline-offset: 6px; }
.tile-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-top: 14px; }
.tile-title { font: 500 1.1875rem/1.2 var(--font-sans); }
.tile-meta { font: 400 0.75rem/1.4 var(--font-mono); color: var(--muted); text-align: right; }
.tile-blurb { display: none; margin: 8px 0 0; color: var(--muted); }
@media (hover: none) { .tile-blurb { display: block; } }

/* ---------- Cassette tapes (Fun rack) ---------- */
.rack { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 640px; }
.tape {
  --cap: var(--tape-vermilion); --cap-ink: #F2F1EA;
  appearance: none; width: 100%; text-align: left; cursor: pointer; text-decoration: none; color: var(--paper-ink);
  display: grid; grid-template-columns: 52px minmax(0, 1fr) 28px; align-items: stretch; height: 64px; padding: 0;
  background: var(--paper); border: 1px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.tape:hover { color: var(--paper-ink); }
.tape.t-ink { --cap: var(--tape-ink); --cap-ink: #E9E9E4; }
.tape.t-bone { --cap: var(--tape-bone); --cap-ink: #141414; }
.tape.t-grey { --cap: var(--tape-grey); --cap-ink: #141414; }
.tape .no { display: grid; place-items: center; background: var(--cap); color: var(--cap-ink); font: 700 1.25rem/1 var(--font-mono); border-right: 1px solid var(--ink); }
.tape .label { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 14px; min-width: 0; background-image: repeating-linear-gradient(transparent 0 15px, rgb(20 20 20 / 0.12) 15px 16px); }
.tape .hand { font-family: var(--font-hand); font-size: 2.125rem; line-height: 1; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tape .meta { font: 400 0.6875rem/1.3 var(--font-mono); color: #55554F; text-align: right; }
.tape::after { content: ""; background: var(--cap); border-left: 1px solid var(--ink); }
@media (hover: hover) and (pointer: fine) { .tape:hover { transform: translate(8px, -2px) rotate(-0.4deg); box-shadow: 6px 6px 0 var(--ink); } }
.tape:active { transform: translate(2px, 1px) scale(0.985); box-shadow: 2px 2px 0 var(--ink); }
.tape[aria-pressed="true"] { box-shadow: 4px 4px 0 var(--accent); }

/* ---------- Footer ---------- */
.site-footer { margin-top: clamp(72px, 10vw, 128px); border-top: 1px solid var(--ink); padding-block: 48px 40px; }
h2.sec { margin: 0; font: 450 1.875rem/1.1 var(--font-serif); letter-spacing: -0.02em; }
.site-footer h2.sec { grid-column: 1 / 4; }
.footer-main { grid-column: 4 / 13; min-width: 0; }
.mail { display: inline-block; padding-block: 6px; font: 450 clamp(1.5rem, 4.2vw, 3.5rem)/1.05 var(--font-serif); letter-spacing: -0.03em; text-decoration-thickness: 2px; overflow-wrap: anywhere; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 22px 0 0; padding: 0; list-style: none; }
.footer-links a { font: 500 0.8125rem/1 var(--font-mono); display: inline-flex; align-items: center; min-height: 44px; }
.footer-base { grid-column: 1 / -1; margin-top: 56px; }
.footer-base p { margin: 0; font: 400 0.75rem/1.4 var(--font-mono); color: var(--muted); }

/* ---------- Page transitions (cross-document; falls back to a normal load) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; animation-timing-function: var(--ease-out); }
::view-transition-group(vt-armada), ::view-transition-group(vt-andromeda), ::view-transition-group(vt-visa), ::view-transition-group(vt-tuvis) { animation-duration: 320ms; animation-timing-function: var(--ease-out); }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* ---------- Narrow screens ---------- */
@media (max-width: 960px) {
  .grid12 { display: block; }
  .layout { display: flex; flex-direction: column; }
  .rail { position: static; margin-top: 64px; }
  .rail dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--gutter); }
  .site-footer h2.sec { margin-bottom: 20px; }
}
@media (max-width: 880px) {
  .mb-row { height: auto; flex-wrap: wrap; padding-block: 0; row-gap: 0; }
  .mb-left { display: contents; }
  .mb-brand { order: 1; }
  .mb-right { order: 2; }
  .mb-nav { order: 3; width: 100%; padding-bottom: 6px; }
  .mb-nav ul { gap: 20px; }
  .mb-nav a { font-size: 0.8125rem; }
  #theme-btn { display: none; }
  .menubar { position: static; }
}
@media (max-width: 560px) { .rail dl { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
