/* The one view: a desktop on wide screens, a phone home screen under 760px. */
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font: 15px/1.5 var(--font-body);
  color: var(--ink);
  background: var(--wall);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
body::before { /* film grain */
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
svg.i { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.solid { fill: currentColor; stroke: none; }
.sprite { position: absolute; }
:focus-visible { outline: 3px solid var(--sea-2); outline-offset: 3px; }
h2[tabindex="-1"]:focus { outline: none; } /* focus moves to the title for screen readers; it isn't a control */

/* each project's colour, on its widget and its window */
#tangent, [data-win="tangent"] { --accent: var(--sea-1); }
#fieldnotes, [data-win="fieldnotes"] { --accent: var(--sea-3); }
#career-kit, [data-win="career-kit"] { --accent: var(--sea-4); }
#tapout, [data-win="tapout"] { --accent: var(--sea-2); }

/* ---------- top bar (desktop) ---------- */
.bar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h); z-index: 20;
  display: flex; align-items: center; gap: 28px; padding: 0 28px;
  background: var(--bar); backdrop-filter: blur(12px); border-bottom: var(--line);
  font-size: 16px;
}
.bar .logo { font: 26px/1 var(--font-name); letter-spacing: -0.02em; text-decoration: none; }
.bar nav { display: flex; gap: 22px; }
.bar nav a { text-decoration: none; font-weight: 500; }
.bar nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- home: name + widgets ---------- */
.home {
  position: fixed; top: var(--bar-h); left: 0; bottom: 0; width: min(640px, 52vw);
  overflow: auto; padding: 56px 40px 40px;
}
.hello h1 { font: clamp(72px, 8vw, 128px)/.88 var(--font-name); letter-spacing: -0.02em; }

.widgets { margin-top: 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; list-style: none; padding: 0; }
.wg {
  width: 100%; height: 100%; text-align: left;
  display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-content: start;
  padding: 16px; border-radius: var(--radius);
  background: var(--paper); border: var(--line); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.wg:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.wg:active { transform: translate(2px, 2px); box-shadow: var(--shadow-sm); }
.wg[aria-current] { background: var(--accent); }
.glyph {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 24px; border: var(--line); background: var(--accent);
}
.wg[aria-current] .glyph { background: var(--paper); }
.wt { display: flex; flex-direction: column; justify-content: center; }
.wt b { font-size: 17px; line-height: 1.2; }
.wt small { font: 11px var(--font-mono); opacity: .6; }
.ws { grid-column: 1 / -1; font-size: 14px; line-height: 1.4; opacity: .8; margin-top: 4px; }

.hello .gh { display: none; } /* phone only: the top bar has GitHub on desktop */
.hello .gh .glyph { background: var(--paper); box-shadow: var(--shadow-sm); }

/* ---------- app windows ---------- */
.win {
  position: fixed; right: 40px; top: calc(var(--bar-h) + 28px); z-index: 10;
  width: min(560px, calc(48vw - 40px)); max-height: calc(100vh - var(--bar-h) - 56px);
  display: none; flex-direction: column; overflow: hidden;
  background: var(--paper); border: var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
}
.win.open { display: flex; animation: pop .22s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.tb { flex: none; display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--accent); border-bottom: var(--line); }
.tb .x { width: 15px; height: 15px; border-radius: 50%; border: var(--line); background: var(--paper); }
.tb .x:hover { background: var(--ink); }
.tb .title { margin-left: 6px; font: 500 13px var(--font-mono); }
.tb .back { display: none; }
.scroll { flex: 1; overflow: auto; overscroll-behavior: contain; }

.video { position: relative; aspect-ratio: 16 / 9; background: var(--ink); border-bottom: var(--line); overflow: hidden; }
.video img, .video video { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.video.tall { aspect-ratio: auto; height: var(--video-tall); }
.video.tall img, .video.tall video { object-fit: contain; object-position: center; }

.body { padding: 20px 22px 28px; }
.meta { font: 11px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; opacity: .6; }
.body h2 { margin-top: 4px; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.tagline { font-size: 17px; opacity: .75; }
.badge { display: inline-block; margin-top: 10px; padding: 3px 10px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--accent); font: 12px var(--font-mono); }
.body h3 { margin-top: 24px; padding-bottom: 8px; border-bottom: 1px solid var(--faint); font: 11px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
.body h3 + p { margin-top: 10px; }
.more summary { cursor: pointer; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more h3::before { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 10px 2px 1px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); transition: transform .15s; }
.more[open] h3::before { transform: rotate(45deg); }
.more summary:hover h3 { opacity: 1; }
.body p + p { margin-top: 10px; }
.points { margin-top: 10px; padding: 0; list-style: none; }
.points li { position: relative; margin-top: 6px; padding-left: 20px; }
.points li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 8px; height: 8px; background: var(--accent); border: 1.5px solid var(--ink); }

.built { margin-top: 24px; padding: 14px; border: var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; }
.tags li { padding: 3px 9px; border: 1px solid var(--soft); border-radius: 8px; font: 12px var(--font-mono); }
.links { margin-top: 12px; display: grid; gap: 8px; }
.links a { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; border: var(--line); border-radius: 10px; text-decoration: none; font-weight: 500; }
.links a:first-child { background: var(--accent); }
.links a:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }

/* ---------- phone: home screen + full-screen apps ---------- */
@media (max-width: 760px) {
  body { overflow: auto; }
  body.app-open { overflow: hidden; }
  .bar { display: none; }
  .home { position: static; width: auto; overflow: visible; padding: calc(env(safe-area-inset-top) + 40px) 16px calc(env(safe-area-inset-bottom) + 40px); }
  .hello { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
  .hello h1 { font-size: 66px; }
  .hello .gh { display: block; margin-top: 6px; font-size: 21px; }
  .hello .gh .glyph { width: 40px; height: 40px; }
  .widgets { margin-top: 28px; gap: 12px; }
  .wg { grid-template-columns: 1fr; padding: 14px; border-radius: 20px; }
  .wg[aria-current] { background: var(--paper); }
  .wg[aria-current] .glyph { background: var(--accent); }
  .wg .glyph { width: 40px; height: 40px; font-size: 21px; }
  .wt b { font-size: 16px; }
  .ws { margin-top: 2px; font-size: 13px; }

  .win { inset: 0; width: auto; max-height: none; border: 0; border-radius: 0; box-shadow: none; z-index: 30; }
  .win.open { animation: zoom .28s cubic-bezier(.2, .9, .3, 1); }
  @keyframes zoom { from { transform: scale(.4); opacity: 0; border-radius: 40px; } }
  .tb { padding: calc(env(safe-area-inset-top) + 14px) 16px 12px; }
  .tb .x { display: none; }
  .tb .back { display: block; font-size: 16px; font-weight: 600; }
  .tb .title { margin: 0 auto; transform: translateX(-24px); }
  .video { aspect-ratio: 4 / 5; }
  .video.wide { aspect-ratio: 16 / 9; } /* landscape image, keep its frame */
  .body { padding: 20px 20px calc(env(safe-area-inset-bottom) + 48px); }
  .tagline { margin-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
