/* =========================================================================
   Het Thoria — portfolio styles

   The look is a printed visitor's guide: warm paper, navy ink, one serif,
   hairline rules, and an ink stamp for every place you visit.

   1. Type and tokens      5. Town: HUD, dock, welcome card
   2. Base                 6. Resume page
   3. Small parts          7. Content blocks (used by both views)
   4. Stamps               8. Dialogs        9. Motion and print
   ========================================================================= */

/* ---------- 1. Type and tokens ---------- */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #fbf7ee;
  --paper-2: #f4eddd;
  --paper-3: #ebe2ce;
  --white: #fffdf8;
  --ink: #1c2340;
  --ink-2: #4b5370;
  --ink-3: #666d86;
  --rule: #ddd4c0;
  --rule-2: #c7bca3;
  --accent: #cf4527;
  --accent-ink: #b4381f;
  --ok: #1c7f4e;

  --theme: var(--accent);        /* a place's colour, as painted on its building */
  --stamp: var(--accent-ink);    /* the same colour as ink: dark enough for small text */
  --surface: var(--paper);       /* whatever the content is sitting on */

  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

  --lift: 0 1px 0 rgba(28, 35, 64, .05), 0 10px 24px -10px rgba(28, 35, 64, .32);
  --float: 0 2px 0 rgba(28, 35, 64, .05), 0 30px 70px -20px rgba(28, 35, 64, .55);

  /* A faint paper grain, so large flat areas do not look like plastic. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .11 0 0 0 0 .14 0 0 0 0 .25 .27 0 0 0 -.1'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Place colours. Keep in step with `theme` and `ink` in js/world.js. */
#about          { --theme: #3f9b63; --stamp: #2c7448; }
#experience     { --theme: #3b7fc4; --stamp: #2a639e; }
#projects       { --theme: #ee7b30; --stamp: #b0521a; }
#skills         { --theme: #55617a; --stamp: #454f69; }
#education      { --theme: #6a5acd; --stamp: #5142ad; }
#certifications { --theme: #a8508c; --stamp: #8a3d72; }
#achievements   { --theme: #d9a21b; --stamp: #8f6a0c; }
#contact        { --theme: #d6453d; --stamp: #b2332c; }
#hobbies        { --theme: #1596a3; --stamp: #0d6f7a; }

/* ---------- 2. Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font: 400 1rem/1.6 var(--sans);
  color: var(--ink);
  background: var(--paper) var(--grain);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, dl, dt, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button { padding: 0; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: #ffdcae; }

.sprite { position: absolute; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- 3. Small parts ---------- */

.ico {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.overline {
  font: 700 .69rem/1.3 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.overline.accent { color: var(--accent-ink); }

.note { font-size: .92rem; color: var(--ink-2); }

kbd {
  display: inline-block;
  min-width: 1.8em;
  margin-right: 3px;
  padding: 2px 6px 1px;
  font: 600 .72rem/1.5 var(--mono);
  text-align: center;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--rule-2);
  border-bottom-width: 2.5px;
  border-radius: 5px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 20px;
  font: 600 .96rem/1 var(--sans);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: transform .12s ease, background-color .12s ease, box-shadow .12s ease;
}
.btn-ink { color: var(--paper); background: var(--ink); box-shadow: 0 2.5px 0 #0c1126; }
.btn-ink:hover { background: #273058; transform: translateY(-1px); box-shadow: 0 3.5px 0 #0c1126; }
.btn-ink:active { transform: translateY(1.5px); box-shadow: 0 1px 0 #0c1126; }
.btn-quiet { color: var(--ink); border-color: var(--rule-2); }
.btn-quiet:hover { background: var(--paper-2); border-color: var(--ink-3); }
.btn-small { min-height: 38px; padding: 0 14px; font-size: .88rem; border-radius: 9px; }

.link-btn { font-size: .86rem; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); text-decoration-color: currentColor; }

/* Close button */
.x {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--ink-2);
  border: 1px solid var(--rule-2);
  border-radius: 10px;
  transition: background-color .12s ease, color .12s ease;
}
.x:hover { color: var(--ink); background: var(--paper-2); }
.x .ico { width: 18px; height: 18px; }
.x-small { width: 30px; height: 30px; border-color: transparent; border-radius: 8px; }
.x-small .ico { width: 15px; height: 15px; }

/* Shown only when JavaScript runs. */
.js-only { display: none; }
.js .js-only { display: inline-flex; }

/* Hints differ for keyboard-and-mouse and for touch screens. */
.for-touch { display: none !important; }
@media (pointer: coarse) {
  .for-keys { display: none !important; }
  .for-touch { display: flex !important; }
}

/* ---------- 4. Stamps ---------- */

/* A small round mark: dashed and empty until its place has been visited. */
.seal {
  --s: 40px;
  flex: none;
  display: grid;
  place-items: center;
  width: var(--s);
  height: var(--s);
  color: var(--ink-3);
  border: 1.5px dashed var(--rule-2);
  border-radius: 50%;
}
.seal .ico { width: 52%; height: 52%; opacity: .6; }
.seal.is-inked {
  color: var(--stamp);
  border: 2px solid currentColor;
  box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3px currentColor;
  transform: rotate(var(--tilt, -6deg));
}
.seal.is-inked .ico { opacity: 1; stroke-width: 2; }

/* The full stamp, with lettering round the rim. Built in js/game.js. */
.stamp {
  display: block;
  width: 78px;
  height: 78px;
  overflow: visible;
  color: var(--stamp);
  transform: rotate(var(--tilt, -6deg));
}
.stamp circle { fill: none; stroke: currentColor; stroke-width: 2.6; }
.stamp .ring-thin { stroke-width: 1; }
.stamp .ring-dash { stroke-width: 1.1; stroke-dasharray: 1.4 3.3; stroke-linecap: round; }
.stamp path { fill: none; stroke: none; }
.stamp text { font: 700 8.4px var(--sans); letter-spacing: 1.5px; text-anchor: middle; fill: currentColor; }
.stamp use { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.stamp.is-fresh { animation: press .55s cubic-bezier(.2, 1.3, .4, 1) .12s both; }

/* ---------- 5. Town: HUD, dock, welcome card ---------- */

#game {
  display: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #a6d99b;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.js[data-mode="game"] #game { display: block; }
.js[data-mode="game"] #resume { display: none; }
.js[data-mode="game"] body { overflow: hidden; }

#world {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.hud {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  pointer-events: none;
}
.hud > * { pointer-events: auto; }

.nameplate {
  padding: 9px 16px 10px;
  background: var(--paper);
  border: 1px solid rgba(28, 35, 64, .16);
  border-radius: 12px;
  box-shadow: var(--lift);
}
.nameplate strong { display: block; font: 600 1.24rem/1.15 var(--display); letter-spacing: -.012em; }
.nameplate span { display: block; margin-top: 3px; font: 700 .61rem/1.2 var(--sans); letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); }

.hud-actions { display: flex; gap: 8px; }

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  font: 600 .9rem/1 var(--sans);
  white-space: nowrap;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid rgba(28, 35, 64, .16);
  border-radius: 12px;
  box-shadow: var(--lift);
  transition: transform .12s ease, background-color .12s ease;
}
.hud-btn:hover { background: var(--white); transform: translateY(-1px); }
.hud-btn .ico { width: 18px; height: 18px; }

/* One dot per place; it fills with the place's colour once visited. */
.pips { display: inline-flex; gap: 4px; margin-left: 3px; }
.pips i { width: 9px; height: 9px; border: 1.5px solid var(--rule-2); border-radius: 50%; }
.pips i.is-on { background: var(--theme); border-color: var(--theme); }
.count { display: none; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }

#minimap {
  position: absolute;
  z-index: 2;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(20px, env(safe-area-inset-bottom));
  border: 4px solid var(--paper);
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(28, 35, 64, .16), var(--lift);
  pointer-events: none;
}
/* Narrower screens need the bottom edge for the speech bubble, so the map moves up under the name. */
@media (max-width: 1000px) {
  #minimap { top: calc(max(14px, env(safe-area-inset-top)) + 70px); bottom: auto; }
}

/* Bottom centre: the "Enter" prompt and the guide bot's speech bubble. */
.dock {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(560px, calc(100vw - 28px));
  pointer-events: none;
}
.dock > * { pointer-events: auto; }

.enter {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 9px 16px 9px 10px;
  text-align: left;
  color: var(--paper);
  background: var(--ink);
  border-radius: 14px;
  box-shadow: 0 3px 0 #0c1126, var(--float);
  animation: fade .18s ease-out;
  transition: transform .12s ease, background-color .12s ease;
}
.enter:hover { background: #273058; transform: translateY(-1px); }
.enter:active { transform: translateY(2px); }
.enter-ico { display: grid; place-items: center; width: 42px; height: 42px; color: var(--stamp); background: var(--paper); border-radius: 10px; }
.enter-ico .ico { width: 24px; height: 24px; }
.enter-text { display: grid; line-height: 1.2; }
.enter-text small { font: 700 .62rem/1.3 var(--sans); letter-spacing: .13em; text-transform: uppercase; opacity: .7; }
.enter-text b { font: 600 1.16rem/1.2 var(--display); }
.enter kbd { margin: 0 0 0 6px; color: var(--paper); background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .34); }

.bot {
  display: none;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 12px;
  width: 100%;
  padding: 10px 10px 10px 12px;
  background: var(--paper);
  border: 1px solid rgba(28, 35, 64, .16);
  border-radius: 14px;
  box-shadow: var(--float);
}
.bot.is-on { display: grid; animation: fade .2s ease-out; }
.bot p { font-size: .94rem; font-weight: 500; line-height: 1.45; }
/* HiFTeR's offers sit under what it says: the suggestion first, then the visitor's own choice. */
.bot-actions { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 2px; }
.bot-actions .btn-quiet { background: var(--white); }
.bot-actions .btn-quiet:hover { background: var(--paper-2); }
.bot-face {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 40px;
  height: 40px;
  background: var(--ink);
  border-radius: 11px;
}
.bot-face i { width: 7px; height: 7px; background: #6ee7ff; border-radius: 50%; box-shadow: 0 0 8px #6ee7ff; animation: blink 4.5s infinite; }

.keys {
  position: absolute;
  z-index: 2;
  right: 14px;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px 7px 10px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--paper);
  border: 1px solid rgba(28, 35, 64, .14);
  border-radius: 10px;
  box-shadow: var(--lift);
}
.keys kbd { margin-right: 1px; }
.keys i { width: 3px; height: 3px; margin: 0 7px; background: var(--rule-2); border-radius: 50%; }
@media (max-width: 1360px), (pointer: coarse) { .keys { display: none; } }

/* Welcome card */
#intro {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
  background: rgba(22, 30, 54, .4);
}
#intro.is-gone { display: none; }

.welcome {
  width: min(560px, 100%);
  padding: 34px 36px 26px;
  background: var(--paper) var(--grain);
  border: 1px solid rgba(28, 35, 64, .2);
  border-radius: 18px;
  box-shadow: var(--float);
  user-select: text;
  -webkit-user-select: text;
  animation: sheet-in .34s cubic-bezier(.2, .9, .3, 1.1);
}
.welcome h1 { margin-top: 10px; font: 600 clamp(2.7rem, 10vw, 3.8rem)/.98 var(--display); letter-spacing: -.035em; }
.welcome-role { margin-top: 12px; font-weight: 600; color: var(--ink-2); }
.welcome-lead { margin-top: 20px; padding-top: 20px; font: 400 1.17rem/1.45 var(--display); border-top: 1px solid var(--rule); }
.welcome-how { margin-top: 10px; font-size: .97rem; color: var(--ink-2); }
.seals { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.seals .seal { --s: 38px; --surface: var(--paper); }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.legend { display: grid; gap: 7px; margin-top: 24px; padding-top: 16px; font-size: .85rem; color: var(--ink-2); border-top: 1px dashed var(--rule-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend li > span { flex: none; }
/* on a wide card the controls sit two to a row, which keeps the card short enough for small laptops */
@media (min-width: 701px) {
  .legend { grid-template-columns: 1fr 1fr; column-gap: 20px; }
}

@media (max-width: 700px) {
  .hud { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); gap: 8px; }
  .nameplate { padding: 11px 12px; }
  .nameplate strong { font-size: 1.08rem; }
  .nameplate span, .pips { display: none; }
  .count { display: inline; }
  .hud-actions { gap: 6px; }
  .hud-btn { padding: 0 11px; gap: 6px; }
  #minimap { left: max(10px, env(safe-area-inset-left)); top: calc(max(14px, env(safe-area-inset-top)) + 54px); }
  .welcome { padding: 26px 22px 20px; }
  .seals { gap: 5px; }
  .seals .seal { --s: 29px; }
  .welcome-actions .btn { flex: 1 1 100%; }
  .legend li > span { min-width: 0; }
}
@media (max-width: 380px) {
  #plainBtn .hud-btn-text { display: none; }
}

/* ---------- 6. Resume page ---------- */

#resume {
  max-width: 1020px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 68px) clamp(20px, 5vw, 44px) 56px;
  counter-reset: sec;
}

.r-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px 44px;
  padding-bottom: 36px;
  border-bottom: 2px solid var(--ink);
}
.r-head h1 { margin-top: 12px; font: 600 clamp(3.1rem, 11vw, 5.8rem)/.92 var(--display); letter-spacing: -.045em; }
.r-title { margin-top: 18px; font: 400 1.28rem/1.4 var(--display); color: var(--ink-2); }
.r-side { display: grid; gap: 20px; justify-items: start; }
.r-links { display: grid; gap: 7px; font-size: .93rem; }
.r-links li { display: grid; grid-template-columns: 74px minmax(0, 1fr); align-items: baseline; gap: 12px; }
.r-links li > span:first-child { font: 700 .63rem/1.3 var(--sans); letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); }
.r-links a { font-weight: 600; text-decoration-color: var(--rule-2); }
.r-links a:hover { text-decoration-color: currentColor; }

#resume section {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  column-gap: 44px;
  padding: 36px 0 38px;
  border-bottom: 1px solid var(--rule);
  counter-increment: sec;
}
#resume section > h2 {
  grid-column: 1;
  grid-row: 1 / span 40;
  align-self: start;
  position: sticky;
  top: 26px;
  font: 600 1.36rem/1.2 var(--display);
  letter-spacing: -.012em;
}
#resume section > h2::before {
  content: counter(sec, decimal-leading-zero);
  display: block;
  margin-bottom: 8px;
  font: 700 .68rem/1 var(--sans);
  letter-spacing: .14em;
  color: var(--stamp);
}
#resume section > :not(h2) { grid-column: 2; }
#resume section > * + * { margin-top: 14px; }
#resume section > h2 + * { margin-top: 0; }

.r-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 20px;
  padding-top: 22px;
  font-size: .82rem;
  color: var(--ink-3);
}

@media (max-width: 780px) {
  .r-head { grid-template-columns: 1fr; }
  #resume section { display: block; padding: 28px 0 30px; }
  #resume section > h2 { position: static; margin-bottom: 18px; }
  #resume section > h2::before { display: inline-block; margin: 0 10px 0 0; }
}

/* ---------- 7. Content blocks ---------- */

.lead { font: 400 1.24rem/1.45 var(--display); letter-spacing: -.005em; }

/* About: a small table of facts */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 30px; margin-top: 24px !important; border-bottom: 1px solid var(--rule); }
.facts > div { padding: 11px 0 12px; border-top: 1px solid var(--rule); }
.facts dt { font: 700 .66rem/1.3 var(--sans); letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); }
.facts dd { margin-top: 3px; font-weight: 600; line-height: 1.4; }
@media (max-width: 540px) { .facts { grid-template-columns: 1fr; } }

/* Experience: a timeline */
.role { position: relative; margin-left: 5px; padding: 0 0 32px 28px; border-left: 1px solid var(--rule-2); }
.role:last-child { padding-bottom: 0; border-left-color: transparent; }
.role::before {
  content: "";
  position: absolute;
  top: 2px;
  left: -6.5px;
  width: 12px;
  height: 12px;
  background: var(--surface);
  border: 3px solid var(--theme);
  border-radius: 50%;
}
.when { font: 600 .74rem/1.4 var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--ink-3); }
.role h3 { margin-top: 5px; font: 600 1.24rem/1.25 var(--display); letter-spacing: -.008em; }
.org { margin-top: 2px; font-weight: 600; color: var(--ink-2); }
.role ul { display: grid; gap: 7px; margin-top: 12px; padding-left: 18px; list-style: disc; }
.role li::marker { color: var(--rule-2); }

/* Projects: the featured one */
.feature {
  padding: 22px 24px 20px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: inset 4px 0 0 var(--theme);
}
.feature h3 { margin-top: 6px; font: 600 2rem/1.08 var(--display); letter-spacing: -.024em; }
.feature-line { margin-top: 6px; font: 400 1.16rem/1.4 var(--display); }
.feature-line + p { margin-top: 12px; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 18px 0 16px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.stats li { padding: 13px 14px 13px 0; }
.stats li + li { padding-left: 14px; border-left: 1px solid var(--rule); }
.stats b { display: block; font: 600 1.75rem/1.05 var(--display); letter-spacing: -.02em; color: var(--stamp); }
.stats span { display: block; margin-top: 5px; font-size: .79rem; line-height: 1.4; color: var(--ink-2); }
.feature .tags { margin-bottom: 12px; }
.feature + .cards { margin-top: 14px !important; }
@media (max-width: 640px) {
  .feature { padding: 18px 18px 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats li:nth-child(3) { padding-left: 0; border-left: 0; }
  .stats li:nth-child(n + 3) { border-top: 1px solid var(--rule); }
}

/* Projects: index cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 18px 18px 16px; background: var(--white); border: 1px solid var(--rule); border-radius: 12px; }
.card h3 { font: 600 1.16rem/1.25 var(--display); letter-spacing: -.008em; }
.tags { display: flex; flex-wrap: wrap; font: 700 .65rem/1.6 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--stamp); }
.tags li + li::before { content: "\00b7"; margin: 0 .55em; color: var(--rule-2); }
.card p { font-size: .94rem; line-height: 1.55; color: var(--ink-2); }
.repo { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin-top: auto; padding-top: 6px; font-size: .88rem; font-weight: 600; text-decoration-color: var(--rule-2); }
.repo:hover { text-decoration-color: currentColor; }
.repo .ico { width: 14px; height: 14px; }

/* Skills: a labelled table of chips */
.skills > div { display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 8px 22px; padding: 13px 0; border-top: 1px solid var(--rule); }
.skills > div:first-child { padding-top: 0; border-top: 0; }
.skills > div:last-child { padding-bottom: 0; }
.skills dt { padding-top: 7px; font: 700 .66rem/1.4 var(--sans); letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { padding: 4px 10px 5px; font-size: .88rem; font-weight: 600; line-height: 1.4; background: var(--white); border: 1px solid var(--rule); border-radius: 7px; }
@media (max-width: 580px) {
  .skills > div { grid-template-columns: 1fr; }
  .skills dt { padding-top: 0; }
}

/* Education, certificates, achievements: ruled lists */
.sub {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 30px !important;
  padding-bottom: 8px;
  font: 700 .69rem/1.3 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--ink);
}
.sub span { font: 600 .74rem/1 var(--mono); letter-spacing: 0; color: var(--ink-3); }
.sub + .entries { margin-top: 0 !important; }
.entry { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
h2 + .entries > .entry:first-child { padding-top: 2px; }
.sheet-body > .entries:first-child > .entry:first-child { padding-top: 2px; }
.entry-main { flex: 1; min-width: 0; }
.entry h3, .entry h4 { font: 600 1rem/1.35 var(--sans); }
.entry p { margin-top: 1px; font-size: .93rem; color: var(--ink-2); }
.entry .entry-note { font-weight: 600; color: var(--ink); }
.entry-meta { flex: none; font: 600 .8rem/1.4 var(--mono); white-space: nowrap; color: var(--ink-2); }

@media (max-width: 540px) { .entry { flex-wrap: wrap; gap: 10px; } }

/* Certificates: a wall of framed prints. Each one opens full size. */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 14px !important; }
.cert {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 6px 6px 12px;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 10px;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.cert:hover { border-color: var(--rule-2); box-shadow: var(--lift); transform: translateY(-3px) rotate(-.5deg); }
.wall li:nth-child(even) .cert:hover { transform: translateY(-3px) rotate(.5deg); }
.cert img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 13 / 10;
  object-fit: cover;
  object-position: top center;
  background: var(--paper-3);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.cert b { display: block; margin: 10px 6px 0; font: 600 .9rem/1.3 var(--sans); }
.cert small { display: block; margin: 3px 6px 0; font-size: .74rem; line-height: 1.4; color: var(--ink-3); }
@media (max-width: 640px) { .wall { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; } }

/* Hobbies: picture cards */
.hobbies { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hobby { display: flex; flex-direction: column; gap: 10px; padding: 8px 8px 12px; background: var(--white); border: 1px solid var(--rule); border-radius: 12px; }
.hobby-art { display: block; width: 100%; height: auto; border-radius: 8px; }
.hobby > span { padding: 0 6px; font: 500 1.1rem/1.3 var(--display); }
@media (max-width: 340px) { .hobbies { grid-template-columns: 1fr; } }

/* The pictures move a little. Anyone who prefers reduced motion gets them still (see the end of this file). */
.art-cricket .bat { transform-origin: 78px 12px; animation: bat-swing 2.8s ease-in-out infinite; }
.art-cricket .ball { animation: ball-hit 2.8s linear infinite; }
@keyframes bat-swing { 0%, 36% { transform: rotate(-30deg); } 52% { transform: rotate(40deg); } 64% { transform: rotate(30deg); } 92%, 100% { transform: rotate(-30deg); } }
@keyframes ball-hit {
  0% { transform: translate(0, 0); opacity: 1; }
  30% { transform: translate(40px, 27px); }
  47% { transform: translate(56px, 16px); }
  52% { transform: translate(50px, 10px); }
  82% { transform: translate(14px, -20px); opacity: 1; }
  88%, 100% { transform: translate(6px, -26px); opacity: 0; }
}

.art-travel .plane { animation: fly 3.6s linear infinite; }
.art-travel .pin { transform-box: fill-box; transform-origin: 50% 100%; animation: pin-drop 3.6s ease-in-out infinite; }
@keyframes fly {
  0% { transform: translate(26px, 46px) rotate(-60deg); opacity: 0; }
  8% { opacity: 1; }
  25% { transform: translate(39px, 32px) rotate(-34deg); }
  50% { transform: translate(55px, 26px) rotate(-9deg); }
  75% { transform: translate(72px, 27px) rotate(15deg); }
  88% { transform: translate(82px, 31px) rotate(34deg); opacity: 1; }
  96%, 100% { transform: translate(86px, 34px) rotate(41deg); opacity: 0; }
}
@keyframes pin-drop { 0%, 84%, 100% { transform: none; } 90% { transform: translateY(-4px); } 95% { transform: scale(1.06, .94); } }

.art-camp .flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flicker .9s ease-in-out infinite alternate; }
.art-camp .flame.inner { animation-duration: .55s; }
.art-camp .glow { animation: glow 1.8s ease-in-out infinite alternate; }
.art-camp .cloth { transform-box: fill-box; transform-origin: 0 50%; animation: wave 1.6s ease-in-out infinite; }
.art-camp .star { animation: twinkle 2.6s ease-in-out infinite; }
.art-camp .s2 { animation-delay: .9s; }
.art-camp .s3 { animation-delay: 1.7s; }
@keyframes flicker { 0% { transform: scale(1, 1); } 50% { transform: scale(.9, 1.14); } 100% { transform: scale(1.06, .92); } }
@keyframes glow { from { opacity: .18; } to { opacity: .34; } }
@keyframes wave { 0%, 100% { transform: scaleX(1) skewY(0); } 50% { transform: scaleX(.84) skewY(7deg); } }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.art-games .hero { animation: jump 1.6s ease-in-out infinite; }
.art-games .shadow { transform-box: fill-box; transform-origin: center; animation: shrink 1.6s ease-in-out infinite; }
.art-games .coin { animation: coin-get 1.6s ease-in-out infinite; }
.art-games .face { transform-box: fill-box; transform-origin: center; animation: spin .8s linear infinite; }
.art-games .key { animation: press 1.6s ease-in-out infinite; }
.art-games .k2 { animation-delay: .2s; }
.art-games .k3 { animation-delay: .4s; }
.art-games .k4 { animation-delay: .6s; }
@keyframes jump { 0%, 70%, 100% { transform: translateY(0); } 30% { transform: translateY(-9px); } }
@keyframes shrink { 0%, 70%, 100% { transform: scale(1); opacity: .18; } 30% { transform: scale(.6); opacity: .1; } }
@keyframes coin-get { 0%, 26% { transform: translateY(0); opacity: 1; } 40% { transform: translateY(-6px); opacity: 0; } 41%, 79% { transform: translateY(0); opacity: 0; } 92%, 100% { opacity: 1; } }
@keyframes spin { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.15); } }
@keyframes press { 0%, 22%, 100% { opacity: 1; } 11% { opacity: .35; } }

.art-spark .spark { transform-box: fill-box; transform-origin: center; animation: sparkle 2.4s ease-in-out infinite; }
.art-spark .s2 { animation-delay: .5s; }
.art-spark .s3 { animation-delay: .9s; }
@keyframes sparkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(.72) rotate(20deg); } }

/* Contact: big ruled links */
.contact-list { border-top: 1px solid var(--ink); }
.contact-list a {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 15px 6px;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: background-color .14s ease, padding .14s ease;
}
.contact-list a:hover { padding-left: 12px; background: var(--paper-2); }
.c-kind { font: 700 .66rem/1.3 var(--sans); letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); }
.c-val { font: 500 1.12rem/1.3 var(--display); overflow-wrap: anywhere; }
.contact-list .ico { width: 16px; height: 16px; color: var(--ink-3); }
@media (max-width: 480px) {
  .contact-list a { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
  .c-kind { grid-column: 1 / -1; }
}

/* ---------- 8. Dialogs ---------- */

dialog {
  max-width: none;
  max-height: none;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
}
dialog::backdrop { background: rgba(22, 30, 54, .5); }

.sheet {
  width: min(790px, calc(100vw - 28px));
  max-height: min(86vh, 880px);
  max-height: min(86dvh, 880px);
  overflow: hidden;
  background: var(--paper) var(--grain);
  border: 1px solid rgba(28, 35, 64, .22);
  border-radius: 18px;
  box-shadow: var(--float);
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet-in .26s cubic-bezier(.2, .9, .3, 1.1); }
.sheet-narrow { width: min(480px, calc(100vw - 28px)); }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 18px 16px 24px;
  border-bottom: 1px solid var(--rule);
  box-shadow: inset 0 4px 0 var(--theme);
}
.sheet-stamp { flex: none; width: 78px; height: 78px; margin: -2px 0 -4px -6px; }
.sheet-stamp:empty { display: none; }
.sheet-titles { flex: 1; min-width: 0; }
.sheet-head h2 { margin-top: 3px; font: 600 2.05rem/1.08 var(--display); letter-spacing: -.022em; }
.sheet-head .x { align-self: flex-start; }

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 24px 26px 30px;
  overflow-y: auto;
  overscroll-behavior: contain;
  outline: none;
}
.sheet-body > * + * { margin-top: 14px; }

.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(235, 226, 206, .5);
  border-top: 1px solid var(--rule);
}

/* Town guide */
.guide-list { margin-top: 14px !important; border-top: 1px solid var(--ink); }
.guide-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 7px 8px 7px 6px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  transition: background-color .14s ease, padding .14s ease;
}
.guide-row:hover { padding-left: 12px; background: var(--paper-2); }
.guide-row .seal { --s: 38px; }
.guide-row b { display: block; font: 600 1.06rem/1.2 var(--display); letter-spacing: -.008em; }
.guide-row small { display: block; margin-top: 1px; font-size: .76rem; color: var(--ink-3); }
.guide-go { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 600; white-space: nowrap; color: var(--ink-2); }
.guide-go .ico { width: 14px; height: 14px; }
/* the place HiFTeR would go next */
.pick {
  display: inline-block;
  margin-left: 8px;
  padding: 0 7px;
  font: 700 .68rem/1.6 var(--sans);
  letter-spacing: .01em;
  vertical-align: 1px;
  color: var(--accent-ink);
  border: 1px solid currentColor;
  border-radius: 999px;
}
.guide-row.is-seen .guide-go { color: var(--ok); }

/* A word with Het */
.talk-face { flex: none; width: 54px; height: 54px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(28, 35, 64, .16); }
.talk-log { display: flex; flex-direction: column; gap: 10px; min-height: 180px; }
.talk-log > * + * { margin-top: 0; }
.msg { max-width: 86%; padding: 10px 14px; line-height: 1.45; border-radius: 14px; animation: fade .2s ease-out; overflow-wrap: anywhere; }
.msg-het { align-self: flex-start; background: var(--white); border: 1px solid var(--rule); border-bottom-left-radius: 4px; }
.msg-you { align-self: flex-end; color: var(--paper); background: var(--ink); border-bottom-right-radius: 4px; }
.msg .btn { margin-top: 10px; }
.msg-wait { color: var(--ink-3); letter-spacing: .2em; }
.talk-form { display: flex; gap: 8px; padding: 12px 14px; background: rgba(235, 226, 206, .5); border-top: 1px solid var(--rule); }
.talk-form input { flex: 1; min-width: 0; height: 42px; padding: 0 14px; font: inherit; color: var(--ink); background: var(--white); border: 1px solid var(--rule-2); border-radius: 10px; }
.talk-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.talk-form .btn { min-height: 42px; }

/* Certificate viewer */
.viewer {
  width: min(1000px, calc(100vw - 20px));
  max-height: 94vh;
  max-height: 94dvh;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid rgba(28, 35, 64, .22);
  border-radius: 16px;
  box-shadow: var(--float);
}
.viewer[open] { display: flex; animation: sheet-in .22s ease-out; }
.viewer-inner { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--rule); }
.viewer-head h2 { font: 600 1.14rem/1.3 var(--display); }
.viewer-head p { margin-top: 1px; font-size: .8rem; color: var(--ink-3); }
.viewer-nav { display: flex; align-items: center; gap: 8px; }
.viewer-nav span { min-width: 4.2em; font: 600 .78rem/1 var(--mono); text-align: center; color: var(--ink-2); }
.viewer-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 14px; overflow: auto; background: var(--paper-3); outline: none; }
.viewer-stage img { display: block; max-width: 100%; max-height: calc(94vh - 150px); object-fit: contain; background: #fff; border-radius: 4px; box-shadow: var(--lift); }
.viewer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px 10px 12px; font-size: .88rem; font-weight: 600; border-top: 1px solid var(--rule); }
.viewer-foot a { display: inline-flex; align-items: center; gap: 6px; }
.viewer-foot .ico { width: 14px; height: 14px; }

/* On phones the sheets slide up from the bottom. */
@media (max-width: 640px) {
  .sheet, .sheet-narrow {
    width: 100vw;
    max-height: 92vh;
    max-height: 92dvh;
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: 18px 18px 0 0;
  }
  .sheet-head { gap: 12px; padding: 18px 14px 14px 18px; }
  .sheet-head h2 { font-size: 1.65rem; }
  .sheet-stamp { width: 64px; height: 64px; margin-left: -4px; }
  .sheet-stamp .stamp { width: 64px; height: 64px; }
  .sheet-body { padding: 20px 18px 26px; }
  .sheet-foot .btn { flex: 1; padding: 0 12px; }
}

/* ---------- 9. Motion and print ---------- */

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 46%, 50%, 100% { transform: scaleY(1); } 48% { transform: scaleY(.15); } }
@keyframes press {
  0% { opacity: 0; transform: rotate(calc(var(--tilt, -6deg) - 16deg)) scale(1.9); }
  55% { opacity: 1; transform: rotate(var(--tilt, -6deg)) scale(.93); }
  100% { opacity: 1; transform: rotate(var(--tilt, -6deg)) scale(1); }
}

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

/* Printing always gives the plain resume, whichever view is on screen. */
@media print {
  #game, dialog, .js-only, .sprite, .cert img, .hobby-art { display: none !important; }
  .wall { display: block; }
  .cert { display: block; padding: 3px 0; border: 0; }
  .cert b, .cert small { display: inline; margin: 0 6px 0 0; }
  .js[data-mode="game"] #resume { display: block; }
  .js[data-mode="game"] body { overflow: visible; }
  body { background: #fff; }
  #resume { max-width: none; padding: 0; --surface: #fff; }
  #resume section { padding: 20px 0; }
  #resume section > h2 { position: static; }
  .card, .facts > div, .role, .entry { break-inside: avoid; }
  .card, .chips li { background: none; }
  a { text-decoration: none; }
}
