/* ================================================================
   thomashymas.com — base styles and the COLOUR look.

   The look is Competitive Sudokus' front door: a navy ground, Poppins,
   solid colour tiles, and white lettering with a hard offset shadow in
   another tile colour. Paper cards sit on the ground and keep dark ink.

   The CLASSIC (newspaper) look lives in classic.css and is switched on by
   <html data-theme="classic"> (theme.js). It works by overriding the tokens
   below plus a few bespoke rules, so keep colours, radii and fonts in
   tokens here instead of writing them into rules.

   No inline styles anywhere: the server's Content-Security-Policy only
   allows stylesheets and scripts from this site's own files.
   ================================================================ */

:root {
  /* Tile colours (Competitive Sudokus' grade colours). */
  --tone-easy:        #009e73;   /* green  */
  --tone-medium:      #ffb000;   /* amber  */
  --tone-hard:        #d62728;   /* red    */
  --tone-problem:     #5f86f0;   /* blue   */
  --tone-ladder:      #b18aff;   /* lilac  */
  --tone-ladder-deep: #5b3fb0;
  --tone-ladder-ink:  #2c1d63;
  --tone-weekend:     #0072b2;   /* deep blue */

  /* The ground and the type on it. */
  --ground:   #1E2747;
  --fg:       #EEF1FA;
  --fg-soft:  #C3C9DE;

  /* Paper cards on the ground. */
  --paper:     #FAFAF6;
  --ink:       oklch(0.235 0.012 265);
  --ink-soft:  oklch(0.47 0.01 265);
  --line:      oklch(0.905 0.004 265);
  --shot-bg:   #ecece6;

  /* Lettering on a solid tile, and the status pill. */
  --on-tile:   #ffffff;
  --pill-bg:   var(--tone-medium);
  --pill-ink:  #1d1e26;

  --radius:    10px;
  --gap:       16px;
  --page-max:  1040px;
  --gutter:    clamp(16px, 4vw, 32px);

  --font-body:    "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-body);
}

*, *::before, *::after { box-sizing: border-box; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--tone-medium); color: var(--pill-ink); }

a { color: inherit; }
img, svg { display: block; max-width: 100%; }
p { margin: 0 0 0.9em; }
p:last-child { margin-bottom: 0; }

:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; border-radius: 3px; }
.card :focus-visible, .panel :focus-visible { outline-color: var(--ink); }

.page {
  max-width: calc(var(--page-max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ── Colour / Classic switch ─────────────────────────────────────
   Each half is a small preview of the look it switches to, so the
   control reads the same in both looks. It scrolls away with the page. */
.theme-toggle {
  position: absolute; top: 14px; right: var(--gutter); z-index: 10;
  display: grid; grid-template-columns: 1fr 1fr;
  border-radius: 9px; overflow: hidden;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.22);
}
.theme-toggle[hidden] { display: none; }
.seg-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 34px; padding: 6px 13px; border: 0; border-radius: 0;
  font-size: 13px; line-height: 1.2; cursor: pointer;
}
.seg-btn:focus-visible { outline-offset: -3px; }
/* The chips keep their own colours in both looks, so their focus rings are
   fixed too: pale on the dark chip, ink on the paper chip. (:root raises the
   specificity above the Classic look's general focus rule.) */
:root .theme-toggle .seg-colour:focus-visible { outline-color: #EEF1FA; }
.seg-colour { background: #14161c; }
.seg-colour .seg-label {
  background: linear-gradient(95deg, #ff6b6b, #ffb000 26%, #2bd4a0 52%, #4aa3e6 76%, #cc79a7);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-family: "Poppins", system-ui, sans-serif; font-weight: 700; letter-spacing: -0.015em;
}
.seg-classic { background: #f6efdd; }
.seg-classic .seg-label {
  color: #2b2113;
  font-family: "Playfair Display", Georgia, serif; font-style: italic; font-weight: 800;
}
:root .theme-toggle .seg-classic:focus-visible { outline-color: #2b2113; }
/* The look in use is marked by a bar under its half. Neither half is dimmed:
   dimming took the labels below readable contrast. */
.seg-colour[aria-pressed="true"]  { box-shadow: inset 0 -4px 0 #EEF1FA; }
.seg-classic[aria-pressed="true"] { box-shadow: inset 0 -4px 0 #2b2113; }

/* ── 1. Intro ──────────────────────────────────────────────────── */
.intro {
  padding: clamp(84px, 14vh, 136px) 0 clamp(20px, 4vw, 40px);
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}

/* The wordmark: one line when there is room, two on a phone. Each letter
   casts the colour the next one wears. */
.wordmark {
  margin: 0 0 clamp(26px, 4vw, 40px);
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.08em 0.34em;
  font-family: var(--font-display);
  font-size: clamp(56px, 9.4vw, 96px); font-weight: 900; line-height: 1;
  text-transform: uppercase;
}
.wm-line { display: flex; }
.wm-letter.tone-easy   { color: var(--tone-easy);    text-shadow: 0.055em 0.055em 0 var(--tone-problem); }
.wm-letter.tone-problem { color: var(--tone-problem); text-shadow: 0.055em 0.055em 0 var(--tone-medium); }
.wm-letter.tone-medium  { color: var(--tone-medium);  text-shadow: 0.055em 0.055em 0 var(--tone-ladder); }
.wm-letter.tone-ladder  { color: var(--tone-ladder);  text-shadow: 0.055em 0.055em 0 var(--tone-hard); }
.wm-letter.tone-hard    { color: var(--tone-hard);    text-shadow: 0.055em 0.055em 0 var(--tone-easy); }

.lede {
  max-width: 34em; margin: 0 0 0.7em;
  font-size: clamp(18px, 2.3vw, 22px); font-weight: 400; line-height: 1.5;
  text-wrap: balance;
}
.facts { max-width: 36em; color: var(--fg-soft); text-wrap: balance; }
.actions { margin: 1.5em 0 0; }

/* ── Buttons: a tile you can press ─────────────────────────────── */
.btn {
  --btn-fill: var(--tone-hard); --btn-shadow: var(--tone-ladder-ink);
  display: inline-block; padding: 14px 26px;
  background: var(--btn-fill); color: var(--on-tile);
  border-radius: var(--radius);
  /* 19px bold counts as large text, so the white label keeps enough contrast
     on the red fill when hover brightens it. */
  font-family: var(--font-display); font-size: 19px; font-weight: 800; line-height: 1.2;
  letter-spacing: 0.02em; text-transform: uppercase; text-decoration: none;
  text-shadow: 2px 2px 0 var(--btn-shadow);
  transition: filter .12s, transform .12s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { filter: brightness(0.96); transform: none; }

/* ── Sections ──────────────────────────────────────────────────── */
.section { margin-top: clamp(56px, 9vw, 104px); scroll-margin-top: 24px; }

.section-title {
  --title-shadow: var(--tone-hard);   /* data-tone="amber": Projects */
  margin: 0 0 clamp(16px, 2.5vw, 24px);
  font-family: var(--font-display);
  font-size: clamp(27px, 4.2vw, 38px); font-weight: 900; line-height: 1.05;
  text-transform: uppercase; color: var(--fg);
  text-shadow: 3px 3px 0 var(--title-shadow);
}
.section-title[data-tone="green"] { --title-shadow: var(--tone-easy); }

/* ── 2. Projects ───────────────────────────────────────────────── */
.cards {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap);
}

.card {
  --card-fill: var(--tone-hard);
  display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  border-radius: var(--radius); overflow: hidden;
}
.card[data-tone="red"]   { --card-fill: var(--tone-hard); }
.card[data-tone="green"] { --card-fill: var(--tone-easy); }
.card[data-tone="lilac"] { --card-fill: var(--tone-ladder-deep); }
.card[data-tone="blue"]  { --card-fill: var(--tone-problem); }

/* The title band: the card's tile colour, lettered like a door tile. */
.card-title {
  margin: 0; padding: 15px 20px 14px;
  background: var(--card-fill); color: var(--on-tile);
  font-family: var(--font-display);
  font-size: clamp(20px, 2.5vw, 25px); font-weight: 900; line-height: 1.1;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 var(--tone-ladder-ink);
}
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 4px; }
.card-title a:focus-visible { outline-color: var(--on-tile); }

.card-shot {
  aspect-ratio: 16 / 10; overflow: hidden;
  background: var(--shot-bg); border-bottom: 1px solid var(--line);
}
.card-shot picture { display: block; height: 100%; }
.card-shot img, .card-shot svg { width: 100%; height: 100%; }
.card-shot img { object-fit: cover; }
/* Cards for games with their own Classic look carry two pictures; only the one
   matching this page's look is shown (classic.css swaps them). The hidden one
   is lazy-loaded, so it is not downloaded unless the look is switched. */
.card-shot .shot-classic { display: none; }

/* The drawn stand-in for the Prospects card: a ranked list beside a map. */
.cf-ground { fill: #e0f5ef; }
.cf-sheet { fill: #ffffff; }
.cf-map { fill: #cfe6dd; }
.cf-rows circle { fill: var(--tone-easy); }
.cf-rows rect { fill: #b9ddd1; }
.cf-road { fill: none; stroke: #ffffff; stroke-width: 7; stroke-linecap: round; }
.cf-pins circle { fill: var(--tone-easy); stroke: #ffffff; stroke-width: 2.5; }

.card-body {
  flex: 1; display: flex; flex-direction: column;
  padding: 18px 20px 20px;
  font-size: 15.5px; line-height: 1.6;
}
.card-body p { margin: 0 0 0.8em; }
.card-body p:last-child { margin-bottom: 0; }

.status > * {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--pill-bg); color: var(--pill-ink);
  font-size: 12.5px; font-weight: 700; line-height: 1.4; letter-spacing: 0.01em;
}
.status a { text-decoration: underline; text-underline-offset: 2px; }
.status a:hover { filter: brightness(1.08); }

.credit { color: var(--ink-soft); font-size: 14px; font-style: italic; }

/* The site link sits at the foot of the card, whatever the text length. */
.card-body p.card-link { margin-top: auto; padding-top: 0.4em; font-weight: 700; }
.card-link a {
  text-decoration: underline; text-decoration-color: var(--card-fill);
  text-decoration-thickness: 3px; text-underline-offset: 4px;
}
.card-link a:hover { text-decoration-color: currentColor; }

.aside { margin: clamp(18px, 3vw, 26px) 0 0; color: var(--fg-soft); }

/* ── 3. Work with me: one wide paper panel ─────────────────────── */
.panel {
  background: var(--paper); color: var(--ink);
  border-radius: var(--radius);
  padding: clamp(22px, 4.5vw, 44px);
}
.panel p { max-width: 42em; }
.panel-lede {
  font-size: clamp(19px, 2.5vw, 24px); font-weight: 700; line-height: 1.35;
  text-wrap: balance;
}
/* Wide screens: the opening line runs across the top, then how I work on the
   left with the good fits and location on the right, and the button below.
   The children are placed by position, so keep the order in index.html:
   lede, how I work, good fits, location, button. */
@media (min-width: 900px) {
  .panel {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    column-gap: clamp(32px, 5vw, 64px); align-items: start;
  }
  .panel > .panel-lede { grid-column: 1 / -1; max-width: 30em; }
  .panel > :nth-child(2) { grid-column: 1; grid-row: 2 / span 2; }
  .panel > :nth-child(3) { grid-column: 2; grid-row: 2; }
  .panel > :nth-child(4) { grid-column: 2; grid-row: 3; }
  .panel > .actions { grid-column: 1 / -1; grid-row: 4; }
}

/* ── 4 and 5. Music and Contact: two tiles ─────────────────────── */
.tiles {
  margin-top: clamp(56px, 9vw, 104px);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap);
}
.tile {
  --tile-fill: var(--tone-ladder-deep);
  padding: clamp(22px, 4vw, 36px);
  background: var(--tile-fill); color: var(--on-tile);
  border-radius: var(--radius);
  scroll-margin-top: 24px;
  container-type: inline-size;   /* lets the big email size itself to the tile */
}
.tile[data-tone="lilac"] { --tile-fill: var(--tone-ladder-deep); }
.tile[data-tone="blue"]  { --tile-fill: var(--tone-weekend); }
.tile-title {
  margin: 0 0 0.6em;
  font-family: var(--font-display);
  font-size: clamp(23px, 3.2vw, 30px); font-weight: 900; line-height: 1.05;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 var(--tone-ladder-ink);
}
.tile :focus-visible { outline-color: var(--on-tile); }
.tile-mail { font-size: clamp(12px, 5.7cqw, 1em); font-weight: 700; overflow-wrap: anywhere; }
.tile-mail a { text-decoration-thickness: 2px; text-underline-offset: 4px; }
.tile-mail a:hover { text-decoration-thickness: 4px; }
/* The contact address is sized from the tile's own width (cqw), so it stays on
   one line at every screen width instead of breaking mid-word. */
.tile-mail-big { font-size: clamp(13px, 6.3cqw, 25px); font-weight: 800; line-height: 1.3; }

/* ── Footer ────────────────────────────────────────────────────── */
.footer {
  padding: clamp(40px, 7vw, 72px) 0 clamp(28px, 5vw, 44px);
  text-align: center; color: var(--fg-soft); font-size: 13.5px;
}

/* ── Narrow screens: one column ────────────────────────────────── */
@media (max-width: 760px) {
  .cards, .tiles { grid-template-columns: minmax(0, 1fr); }
}
