/* =====================================================
   STYLE.CSS - every look-and-feel setting lives here.
   The site is styled as a circuit board (like KiCad):
   a gray "substrate", faint covered traces, gold traces
   that lead to links. The traces are drawn by js/board.js.
   ===================================================== */

/* ---- 1. FONT: change this ONE line to change the font everywhere.
        (To use a Google font, see README "Changing the font".) ---- */
:root { --font: "Helvetica Neue", Arial, sans-serif; }

/* ---- 2. COLOURS (light mode = default) ---- */
:root {
  --text: #111111;          /* all text */
  --substrate: #d5d8db;     /* the board itself */
  --substrate-2: #c8ccd0;   /* the fixed top bar (a separate little board) */
  --trace: #c0c5ca;         /* covered traces: only a slightly different gray */
  --edge: #9aa0a6;          /* the edge line of the top bar */
  --gold: #b5851c;          /* exposed gold traces + pads (darker in light mode) */
  --gold-shine: #dcb95e;    /* thin highlight on gold traces */
  --card: rgba(213,216,219,.9);   /* panels with text on them */
  --curl-front: #111111;    /* page-turn corner = OPPOSITE mode */
  --note-bg: rgba(200,204,208,.92);
  /* project-tile glow colours (set by "status:" in project.md) */
  --glow-complete: #3ddc68;
  --glow-progress: #ffd43b;
  --glow-abandoned: #ff4d4d;
  --glow-none: rgba(255,255,255,.85);    /* default: soft white */
  --header-h: 4.4rem;       /* height of the top bar */
}
/* Dark mode: switched by js/theme.js */
:root[data-theme="dark"] {
  --text: #ffffff;
  --gold: #d4a73a; --gold-shine: #f3dc92;
  --substrate: #292c2f; --substrate-2: #1f2225; --trace: #393e43; --edge: #0d0f10;
  --card: rgba(34,37,40,.9); --curl-front: #ffffff; --note-bg: rgba(31,34,37,.92);
}

/* ---- 3. LANDING PAGE LINK POSITIONS (index.html) ----
   left/top are percentages of the screen. Move them freely!
   (The gold traces follow the words. Where each trace starts is
   set by data-via="x,y" in index.html.)  */
:root {
  --name-left: 70%;     --name-top: 50%;      /* NAME     */
  --projects-left: 30%; --projects-top: 30%;  /* Projects */
  --misc-left: 30%;     --misc-top: 70%;      /* Misc     */
  --landing-size: 4rem;                       /* size of those 3 words */
}

/* ---- Base ---- */
* { box-sizing: border-box; font-family: var(--font); }
html, body { margin: 0; height: 100%; }
body { color: var(--text); background: var(--substrate); position: relative; overflow: hidden; }
body.scroll { overflow-y: auto; }   /* class="scroll" on <body> = page can scroll */
body.cat { --header-h: 7.8rem; }    /* project list pages have a taller top bar (two rows) */
a { color: var(--text); cursor: pointer; }
button { cursor: pointer; }
main { position: relative; z-index: 1; }

/* ---- Board drawing layers (filled in by js/board.js) ---- */
.board-bg { position: absolute; top: 0; left: 0; z-index: 0; pointer-events: none; --hole: var(--substrate); }
.hdr-svg  { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; --hole: var(--substrate-2); }
.cv       { fill: none; stroke: var(--trace); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.cv-ring  { fill: var(--trace); }
.cv-hole  { fill: var(--hole, var(--substrate)); }
.gd       { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.gd-shine { fill: none; stroke: var(--gold-shine); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.gd-via, .gd-pad { fill: var(--gold); }
.gd-hole  { fill: var(--hole, var(--substrate)); }

/* ---- Top bar: a separate little board fixed at the top of every subpage ---- */
.top-board {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 5;
  background: var(--substrate-2); border-bottom: 3px solid var(--edge);
  box-shadow: 0 5px 14px rgba(0,0,0,.35);
}
.top-nav { position: relative; z-index: 1; display: flex; align-items: center; gap: 3rem;
           height: 4.4rem; padding: 0 5rem 0 3.2rem; font-size: 1.3rem; }
.top-nav a { text-decoration: none; font-weight: 700; }
.top-nav a:hover { text-decoration: underline; }

/* second row on project list pages:  <arrow>  Title  <arrow>  (no traces) */
.cat-bar { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 1.6rem;
           height: 3.4rem; padding: 0 1rem; }
.cat-title { margin: 0; font-size: 1.9rem; text-align: center; min-width: 10rem; }

/* gold-outlined arrows that point outwards */
.arrow { position: relative; flex: none; width: 2.2rem; height: 2.6rem; display: inline-block; }
.arrow::before, .arrow::after { content: ""; position: absolute; }
.arrow::before { inset: 0; background: var(--gold); }
.arrow::after  { inset: 4px 3px; background: #141414; transition: background .15s; }
.arrow:hover::after, .arrow:focus-visible::after { background: color-mix(in srgb, var(--gold) 35%, #141414); }
.arrow:focus-visible { outline: none; }
.arrow-left::before,  .arrow-left::after  { clip-path: polygon(0 50%, 100% 0, 100% 100%); }
.arrow-right::before, .arrow-right::after { clip-path: polygon(0 0, 100% 50%, 0 100%); }

/* ---- Landing page ---- */
.landing-link {
  position: absolute; z-index: 1; transform: translate(-50%, -50%);
  font-size: var(--landing-size); font-weight: 800; text-decoration: none;
}
.landing-link:hover { text-decoration: underline; }
#link-name     { left: var(--name-left);     top: var(--name-top); }
#link-projects { left: var(--projects-left); top: var(--projects-top); }
#link-misc     { left: var(--misc-left);     top: var(--misc-top); }

/* ---- Generic content pages ---- */
.page { max-width: 900px; margin: 0 auto; padding: calc(var(--header-h) + 1.5rem) 2.4rem 4rem; }
.page.center { text-align: center; }
.page h1 { font-size: 3rem; margin-top: 0; }
.panel { background: var(--card); border-radius: 12px; padding: 1.2rem 1.5rem; margin-bottom: 1.5rem; }
.big-links a { display: inline-block; font-size: 2.2rem; margin: 1.2rem 0; }
.tags span { display: inline-block; border: 1px solid var(--text); border-radius: 99px; padding: 0 .7rem; margin-right: .4rem; font-size: .85rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.gallery img { width: 100%; border-radius: 8px; }

/* ---- Project list pages: hexagon field ---- */
body.cat main.hex-page { max-width: none; padding: calc(var(--header-h) + 1rem) 0 3rem; }
.hex-msg { text-align: center; margin: 1rem; }
#hex-grid { position: relative; margin: 0 auto; }
#hex-grid svg { position: absolute; top: 0; left: 0; pointer-events: none; --hole: var(--substrate); }
.hex-line { fill: none; stroke: var(--trace); stroke-linejoin: round; stroke-linecap: round; }

.hex { position: absolute; z-index: 1; display: block; text-decoration: none; color: #fff;
       transition: transform .18s ease; --glow: var(--glow-none); }
.hex.status-complete  { --glow: var(--glow-complete); }
.hex.status-progress  { --glow: var(--glow-progress); }
.hex.status-abandoned { --glow: var(--glow-abandoned); }
.hex:hover, .hex:focus-visible, .hex.active { transform: scale(1.14); z-index: 3; outline: none; }
.hex-glow { display: block; width: 100%; height: 100%;      /* soft light "under" the tile */
            filter: drop-shadow(0 0 5px var(--glow)) drop-shadow(0 0 14px var(--glow)); }
.hex-shape { display: block; position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--trace);
             clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.hex-shape img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hex-over { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
            text-align: center; padding: 20% 15%; background: rgba(0,0,0,.8); opacity: 0; transition: opacity .18s; }
.hex:hover .hex-over, .hex:focus-visible .hex-over, .hex.active .hex-over { opacity: 1; }
.hex-over b { font-size: calc(var(--hw) * .085); line-height: 1.15; margin-bottom: .35em; }
.hex-over small { font-size: calc(var(--hw) * .062); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.hex.noimg .hex-over { opacity: 1; background: transparent; color: var(--text); }

/* ---- Project detail page: text sits on a panel so traces don't hurt readability ---- */
#project-detail { background: var(--card); border-radius: 12px; margin-top: 0; padding: 1.5rem 2rem; }
.page#project-detail { padding-top: 1.5rem; }
.detail-wrap { max-width: 900px; margin: 0 auto; padding: calc(var(--header-h) + 1.5rem) 1.5rem 4rem; }

/* ---- Page-turn dark/light toggle (top right) ---- */
.curl {
  position: fixed; top: 0; right: 0; width: 70px; height: 70px; border: 0; padding: 0; z-index: 10;
  background: linear-gradient(to bottom left, var(--curl-front) 0%, var(--curl-front) 45%, rgba(128,128,128,.6) 50%, transparent 51%);
  filter: drop-shadow(-3px 3px 4px rgba(0,0,0,.35));
  transition: width .2s, height .2s;
}
.curl:hover, .curl:focus-visible { width: 95px; height: 95px; }

@media (max-width: 600px) {
  :root { --landing-size: 2.6rem; }
  .top-nav { gap: 1.6rem; padding-left: 2.2rem; font-size: 1.15rem; }
  .cat-bar { gap: 1rem; }
  .cat-title { font-size: 1.35rem; min-width: 6.5rem; }
  .arrow { width: 1.9rem; height: 2.3rem; }
  .page { padding-left: 2rem; padding-right: 1.2rem; }
  #project-detail { padding: 1rem; }
}

/* ---- Images/videos inside project pages: centered, standard distance from text ---- */
.media { margin: 2rem auto; text-align: center; }               /* change 2rem to adjust spacing */
.media img, .media video { max-width: 100%; height: auto; border-radius: 8px; }
.media iframe { width: 100%; max-width: 720px; aspect-ratio: 16/9; border: 0; border-radius: 8px; }
.media figcaption { margin-top: .5rem; font-size: .9rem; opacity: .8; }

/* ---- Markdown text inside project pages ---- */
.md h2, .md h3, .md h4 { margin: 1.6rem 0 .4rem; }
.md ul, .md ol { padding-left: 1.6rem; }
.md blockquote { margin: 1rem 0; padding: .1rem 1rem; border-left: 4px solid var(--gold); background: rgba(128,128,128,.15); }
.md code, .md pre { font-family: monospace; background: rgba(128,128,128,.18); border-radius: 4px; }
.md code { padding: 0 .3rem; }
.md pre { padding: .8rem 1rem; overflow-x: auto; }
.md pre code { padding: 0; }
.md hr { border: 0; border-top: 1px solid var(--text); opacity: .4; margin: 1.5rem 0; }

/* Site-wide note at the bottom of every page (text is in js/theme.js) */
.site-note {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  text-align: center; font-size: .85rem; padding: .4rem 1rem;
  background: var(--note-bg);
  pointer-events: none;                 /* never blocks clicks on anything behind it */
}
