/* ==========================================================================
   HALFTONE LAYOUT: the portfolio's second theme
   --------------------------------------------------------------------------
   Active only when <html data-layout="halftone"> (set before first paint from
   site-config.js). It reuses the classic layout's markup: this file reskins
   it and reveals the .ht-only extras (sidebar, halftone portrait, highlights
   strip, GitHub section). Nothing here applies to data-layout="classic".
   ========================================================================== */

/* Extras never show in the classic layout */
html:not([data-layout="halftone"]) .ht-only { display: none !important; }

/* ==========================================================================
   TOKENS: monochrome; the accent is the ink colour
   ========================================================================== */
html[data-layout="halftone"] {
  --ht-mono:  'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;
  --ht-pixel: 'Geist Pixel', 'Geist Mono', 'JetBrains Mono', monospace;
  --ht-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --ht-side-w: 224px;
  scroll-padding-top: 24px;
}
html[data-layout="halftone"][data-theme="light"] {
  --bg:            #ffffff;
  --bg-page:       #ffffff;
  --card:          #ffffff;
  --card-soft:     #f5f5f5;
  --border:        #e9e9e9;
  --border-strong: #d4d4d4;
  --text:          #0a0a0a;
  --text-soft:     #525252;
  --text-muted:    #737373;
  --text-faint:    #a3a3a3;
  --accent:        #0a0a0a;
  --accent-soft:   #f5f5f5;
  --accent-text:   #0a0a0a;
  --ht-raise:      #fafafa;
  --ht-dot:        rgba(10, 10, 10, 0.11);
  color-scheme: light;
}
html[data-layout="halftone"][data-theme="dark"] {
  --bg:            #0c0c0f;
  --bg-page:       #0c0c0f;
  --card:          #0c0c0f;
  --card-soft:     #1e1e22;
  --border:        #2a2a30;
  --border-strong: #3a3a42;
  --text:          #f4f4f5;
  --text-soft:     #b8b8c0;
  --text-muted:    #a0a0a8;
  --text-faint:    #8a8a92;
  --accent:        #f4f4f5;
  --accent-soft:   #1e1e22;
  --accent-text:   #f4f4f5;
  --ht-raise:      #131316;
  --ht-dot:        rgba(244, 244, 245, 0.10);
  color-scheme: dark;
}

/* ==========================================================================
   PAGE FRAME: fixed sidebar + one narrow column
   ========================================================================== */
html[data-layout="halftone"],
html[data-layout="halftone"] body {
  font-family: 'Geist', 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}
html[data-layout="halftone"] body { position: relative; overflow-x: hidden; }
html[data-layout="halftone"] ::selection { background: var(--text); color: var(--bg); }

/* Faint dot field fading out behind the hero */
html[data-layout="halftone"] body::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 560px;
  pointer-events: none; z-index: 0;
  background-image: radial-gradient(var(--ht-dot) 1px, transparent 1.6px);
  background-size: 14px 14px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
}

html[data-layout="halftone"] .page {
  position: relative; z-index: 1;
  max-width: 672px;
  margin: 0 auto;
  padding: 0 24px 56px;
  display: flex; flex-direction: column;
}
@media (min-width: 1024px) {
  html[data-layout="halftone"] body { padding-left: var(--ht-side-w); }
}

/* The classic two-column wrappers dissolve so every section is one flex item,
   then `order` puts them in the halftone reading order. */
html[data-layout="halftone"] .main-grid,
html[data-layout="halftone"] .main-grid > .stack { display: contents; }

html[data-layout="halftone"] .hero        { order: 1; }
html[data-layout="halftone"] .ht-stats    { order: 2; }
html[data-layout="halftone"] #about       { order: 3; }
html[data-layout="halftone"] #projects    { order: 5; }
html[data-layout="halftone"] #experience  { order: 6; }
html[data-layout="halftone"] #tech        { order: 7; }
html[data-layout="halftone"] #certs       { order: 8; }
html[data-layout="halftone"] #recs        { order: 9; }
html[data-layout="halftone"] #github      { order: 10; }
html[data-layout="halftone"] #contact     { order: 11; }
html[data-layout="halftone"] .footer-copy { order: 12; }

/* ==========================================================================
   SIDEBAR (desktop) + TOP BAR (mobile)
   ========================================================================== */
html[data-layout="halftone"] .ht-side {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  width: var(--ht-side-w);
  padding: 32px 28px;
  display: none; flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
@media (min-width: 1024px) {
  html[data-layout="halftone"] .ht-side { display: flex; }
}

html[data-layout="halftone"] .ht-brand {
  font-family: var(--ht-pixel);
  font-size: 15px; line-height: 1;
  color: var(--text);
  flex-shrink: 0;
  transition: opacity 200ms;
}
html[data-layout="halftone"] .ht-brand:hover { opacity: 0.6; }

html[data-layout="halftone"] .ht-nav {
  display: flex; flex-direction: column; align-items: flex-start; gap: 11px;
  margin-top: 30px;
}
html[data-layout="halftone"] .ht-nav + .ht-nav {
  margin-top: 22px; padding-top: 22px;
  border-top: 1px solid var(--border);
  align-self: stretch;
}
html[data-layout="halftone"] .ht-nav a {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--ht-mono);
  font-size: 13px; line-height: 1.5;
  color: var(--text-muted);
  transition: color 200ms;
}
html[data-layout="halftone"] .ht-nav a i { width: 14px; font-size: 12px; text-align: center; }
html[data-layout="halftone"] .ht-nav a:hover,
html[data-layout="halftone"] .ht-nav a.is-active { color: var(--text); }
/* Marker for the section currently on screen */
html[data-layout="halftone"] .ht-nav-sections a::before {
  content: '';
  position: absolute; left: -13px; top: 50%;
  width: 5px; height: 5px; margin-top: -2.5px;
  background: var(--text);
  opacity: 0; transform: scale(0.4);
  transition: opacity 200ms, transform 200ms;
}
html[data-layout="halftone"] .ht-nav-sections a.is-active::before { opacity: 1; transform: none; }

html[data-layout="halftone"] .ht-side-foot { margin-top: auto; padding-top: 28px; }
html[data-layout="halftone"] .ht-keys {
  display: flex; flex-direction: column; gap: 8px;
  font-size: 11.5px; color: var(--text-muted);
}
/* "N people viewing now": overlapping face icons + count (simulated in js/halftone.js) */
html[data-layout="halftone"] .ht-viewers {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 20px; padding-top: 18px;
  border-top: 1px solid var(--border);
}
html[data-layout="halftone"] .ht-viewer-faces { display: flex; align-items: center; }
html[data-layout="halftone"] .ht-viewer-faces > * {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  margin-left: -7px;
  font-size: 11px;
  color: var(--text);
  background: var(--card-soft);
  border: 2px solid var(--bg);
  border-radius: 50%;
  transition: opacity 300ms ease;
}
html[data-layout="halftone"] .ht-viewer-faces > :first-child { margin-left: 0; }
html[data-layout="halftone"] .ht-viewer-faces .is-swapping { opacity: 0; }
html[data-layout="halftone"] .ht-viewer-more {
  width: auto; min-width: 24px; padding: 0 5px;
  font-family: var(--ht-mono); font-size: 9px; font-weight: 500;
  border-radius: 999px;
}
html[data-layout="halftone"] .ht-viewer-more[hidden] { display: none; }
html[data-layout="halftone"] .ht-viewer-line { font-size: 11.5px; color: var(--text-muted); }
html[data-layout="halftone"] .ht-viewer-line b {
  display: inline-block;
  font-family: var(--ht-mono); font-weight: 500;
  color: var(--text);
}
html[data-layout="halftone"] .ht-viewer-line b.is-ticking { animation: ht-tick 360ms ease; }
@keyframes ht-tick {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-layout="halftone"] .ht-viewer-line b.is-ticking { animation: none; }
}

html[data-layout="halftone"] .ht-keys kbd {
  margin-left: 6px; padding: 1px 6px;
  font-family: var(--ht-mono); font-size: 10px;
  color: var(--text-soft);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
}
html[data-layout="halftone"] .ht-mode {
  display: inline-flex; gap: 2px;
  margin-top: 20px; padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
}
html[data-layout="halftone"] .ht-mode button,
html[data-layout="halftone"] .ht-top-mode {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 24px; padding: 0;
  font-size: 11px;
  color: var(--text-muted);
  background: none; border: 0; border-radius: 999px;
  cursor: pointer;
  transition: color 200ms, background-color 200ms;
}
html[data-layout="halftone"] .ht-mode button:hover,
html[data-layout="halftone"] .ht-top-mode:hover { color: var(--text); }
html[data-layout="halftone"] .ht-mode button[aria-pressed="true"] {
  color: var(--text);
  background: var(--accent-soft);
}
html[data-layout="halftone"] .ht-mode button:focus-visible,
html[data-layout="halftone"] .ht-top-mode:focus-visible,
html[data-layout="halftone"] .ht-more:focus-visible {
  outline: 2px solid var(--text); outline-offset: 2px;
}
html[data-layout="halftone"] .ht-reach {
  margin: 20px 0 8px; padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px; line-height: 1.5;
  color: var(--text-muted);
}
html[data-layout="halftone"] .ht-mail {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--ht-mono); font-size: 12px;
  color: var(--text);
  transition: opacity 200ms;
}
html[data-layout="halftone"] .ht-mail:hover { opacity: 0.6; }

html[data-layout="halftone"] .ht-top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
html[data-layout="halftone"] .ht-top-mode {
  width: 32px; height: 28px;
  border: 1px solid var(--border);
  font-size: 12px;
}
@media (min-width: 1024px) {
  html[data-layout="halftone"] .ht-top { display: none; }
}

/* ==========================================================================
   HERO: halftone portrait left, pixel-type name + bio right
   ========================================================================== */
html[data-layout="halftone"] .hero {
  grid-template-columns: 288px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  margin: 0;
  padding: 112px 0 64px;
  background: none;
  border: 0;
}
/* Classic-only hero pieces */
html[data-layout="halftone"] .hero-toggle-wrap,
html[data-layout="halftone"] .avatar-wrap,
html[data-layout="halftone"] .verified-badge,
html[data-layout="halftone"] .hero-roles,
html[data-layout="halftone"] .hero-actions { display: none; }

/* 3x3 sprite; js/halftone.js sets --fx / --fy (0..2) to pick the view */
html[data-layout="halftone"] .ht-portrait {
  width: 100%; max-width: 288px;
  aspect-ratio: 1;
  background-repeat: no-repeat;
  background-size: 300% 300%;
  background-position: calc(var(--fx, 1) * 50%) calc(var(--fy, 1) * 50%);
  touch-action: pan-y;
  cursor: crosshair;
  -webkit-user-select: none; user-select: none;
}
/* Ordered-dither (halftone) photo sprite with a transparent background, so one file
   serves both colour modes. One dither dot is 2 image px = 1 CSS px at 288px wide. */
html[data-layout="halftone"] .ht-portrait {
  background-image: url("../images/portrait-dither.webp");
}

html[data-layout="halftone"] .hero-name {
  display: block;
  margin: 2px 0 0;
  font-family: var(--ht-pixel);
  font-size: 41.6px; font-weight: 400;
  line-height: 1.04; letter-spacing: 0;
}
html[data-layout="halftone"] .hero-loc {
  margin: 16px 0 0;
  font-family: var(--ht-mono);
  font-size: 12px;
  color: var(--text-muted);
}
html[data-layout="halftone"] .ht-bio { margin-top: 22px; }
html[data-layout="halftone"] .ht-bio p {
  margin: 0;
  font-size: 15px; line-height: 2;              /* room for the chips */
  color: var(--text-soft);
}
html[data-layout="halftone"] .ht-bio p + p { margin-top: 14px; }
/* Key phrases sit in small pills with an icon */
html[data-layout="halftone"] .ht-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 8px;
  font-weight: 500; line-height: 1.75;
  color: var(--text);
  background: var(--card-soft);
  border-radius: 7px;
  white-space: nowrap;
}
html[data-layout="halftone"] .ht-chip i { font-size: 0.78em; }
/* A small cluster of AI marks in front of "AI-assisted development" */
html[data-layout="halftone"] .ht-ai {
  display: inline-flex; align-items: center; gap: 5px;
  margin-right: 3px;
  vertical-align: -0.08em;
  color: var(--text);
}
html[data-layout="halftone"] .ht-ai svg { width: 13px; height: 13px; fill: currentColor; }
html[data-layout="halftone"] .ht-ai i { font-size: 12px; }
html[data-layout="halftone"] .ht-socials {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin-top: 26px;
  font-family: var(--ht-mono);
  font-size: 13px;
  color: var(--text-muted);
}
html[data-layout="halftone"] .ht-socials a { transition: color 200ms; }
html[data-layout="halftone"] .ht-socials a:hover { color: var(--text); }

@media (max-width: 1023px) {
  html[data-layout="halftone"] .hero { padding-top: 56px; }
}
@media (max-width: 719px) {
  html[data-layout="halftone"] .hero { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-bottom: 48px; }
  html[data-layout="halftone"] .hero-name { font-size: 34px; }
}

/* ==========================================================================
   HIGHLIGHTS STRIP
   ========================================================================== */
html[data-layout="halftone"] .ht-stats { border-top: 1px solid var(--border); }
html[data-layout="halftone"] .ht-badges,
html[data-layout="halftone"] .ht-figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
html[data-layout="halftone"] .ht-badges { padding: 20px 0; }
html[data-layout="halftone"] .ht-figures { border-top: 1px solid var(--border); }
html[data-layout="halftone"] .ht-badge,
html[data-layout="halftone"] .ht-figure {
  min-width: 0;
  padding: 0 18px;
  border-left: 1px solid var(--border);
}
html[data-layout="halftone"] .ht-badge:first-child,
html[data-layout="halftone"] .ht-figure:first-child { padding-left: 0; border-left: 0; }
html[data-layout="halftone"] .ht-badge:last-child,
html[data-layout="halftone"] .ht-figure:last-child { padding-right: 0; }

html[data-layout="halftone"] .ht-badge { display: flex; align-items: center; gap: 12px; }
html[data-layout="halftone"] .ht-badge i { flex-shrink: 0; width: 20px; font-size: 16px; text-align: center; color: var(--text); }
html[data-layout="halftone"] .ht-badge > div { min-width: 0; }
html[data-layout="halftone"] .ht-badge b,
html[data-layout="halftone"] .ht-badge span,
html[data-layout="halftone"] .ht-figure span {
  display: block;
  font-family: var(--ht-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
html[data-layout="halftone"] .ht-badge b { font-size: 12px; font-weight: 500; color: var(--text); }
html[data-layout="halftone"] .ht-badge span,
html[data-layout="halftone"] .ht-figure span {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted);
}
html[data-layout="halftone"] .ht-figure { padding-top: 24px; padding-bottom: 24px; }
html[data-layout="halftone"] .ht-figure b {
  display: block;
  font-family: var(--ht-pixel);
  font-size: 24px; font-weight: 400; line-height: 1.1;
  color: var(--text);
}
html[data-layout="halftone"] .ht-figure span { margin-top: 10px; }

@media (max-width: 559px) {
  html[data-layout="halftone"] .ht-badges { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  html[data-layout="halftone"] .ht-badge { padding: 0; border-left: 0; }
  html[data-layout="halftone"] .ht-figure { padding-left: 12px; padding-right: 8px; }
  html[data-layout="halftone"] .ht-figure b { font-size: 20px; }
  /* Three narrow columns: let "CERTIFICATIONS" wrap instead of truncating */
  html[data-layout="halftone"] .ht-figure span { white-space: normal; letter-spacing: 0.06em; overflow-wrap: anywhere; }
}

/* ==========================================================================
   SECTIONS: classic .card becomes a borderless, numbered block
   ========================================================================== */
html[data-layout="halftone"] .card {
  margin-top: 88px !important;   /* two sections carry an inline margin-top */
  padding: 0;
  background: none;
  border: 0;
  scroll-margin-top: 64px;
}
html[data-layout="halftone"] .card-title {
  justify-content: flex-start; align-items: baseline;
  margin: 0 0 24px;
  font-family: var(--ht-pixel);
  font-size: 14px; font-weight: 400; letter-spacing: 0;
  text-transform: lowercase;
  color: var(--text-muted);
}
html[data-layout="halftone"] .card-title::before { margin-right: 0.6ch; white-space: pre; }
html[data-layout="halftone"] #about      .card-title::before { content: '01 \2014'; }
html[data-layout="halftone"] #projects   .card-title::before { content: '02 \2014'; }
html[data-layout="halftone"] #experience .card-title::before { content: '03 \2014'; }
html[data-layout="halftone"] #tech       .card-title::before { content: '04 \2014'; }
html[data-layout="halftone"] #certs      .card-title::before { content: '05 \2014'; }
html[data-layout="halftone"] #recs       .card-title::before { content: '06 \2014'; }
html[data-layout="halftone"] #github     .card-title::before { content: '07 \2014'; }
html[data-layout="halftone"] #contact    .card-title::before { content: '08 \2014'; }

html[data-layout="halftone"] .card-title .view-all {
  margin-left: auto;
  font-family: var(--ht-mono);
  font-size: 11px; font-weight: 400; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
html[data-layout="halftone"] .card-title .view-all:hover { color: var(--text); }
html[data-layout="halftone"] .card-title .view-all i { display: none; }
html[data-layout="halftone"] .card-title .view-all::after { content: '\2192'; margin-left: 6px; }
html[data-layout="halftone"] #github .card-title .view-all::after { content: '\2197'; }
/* Placeholder "View All" links that go nowhere */
html[data-layout="halftone"] .card-title .view-all[href="#"] { display: none; }

/* --- 01 about ---------------------------------------------------------- */
html[data-layout="halftone"] .about-text { font-size: 15px; line-height: 1.7; }
html[data-layout="halftone"] .about-text strong { font-weight: 500; }
html[data-layout="halftone"] .about-text + .about-text { margin-top: 16px; }

/* The BONG-DA-DEV access card belongs to the classic layout only */
html[data-layout="halftone"] .acard-scene { display: none; }

/* --- 02 projects ------------------------------------------------------- */
html[data-layout="halftone"] .proj-grid { gap: 12px; }
html[data-layout="halftone"] .proj,
html[data-layout="halftone"] .cert,
html[data-layout="halftone"] .rc-slide {
  background: var(--ht-raise);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color 200ms, transform 200ms;
}
html[data-layout="halftone"] .proj:hover,
html[data-layout="halftone"] .cert:hover { border-color: var(--border-strong); transform: translateY(-2px); }
html[data-layout="halftone"] .proj { display: flex; flex-direction: column; padding: 18px; }
html[data-layout="halftone"] .proj-name { font-size: 15px; font-weight: 500; }
html[data-layout="halftone"] .proj-name i { font-size: 9px; }
html[data-layout="halftone"] .proj-desc { margin: 4px 0 16px; font-size: 13.5px; line-height: 1.55; }
html[data-layout="halftone"] .proj-url {
  margin-top: auto; align-self: flex-start; max-width: 100%;
  padding: 0;
  font-family: var(--ht-mono); font-size: 11px;
  color: var(--text-muted);
  background: none; border: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Projects deck: js/halftone.js adds .ht-deck and turns the grid into a fan of three
   cards (front, one peeking each side). Clicking a peeking card deals it to the front.
   Without JS none of this applies and the grid above is what shows. */
html[data-layout="halftone"] .proj-grid.ht-deck {
  --ht-fan-x: 132px;                       /* how far the side cards sit from centre */
  display: block;
  position: relative;
  height: calc(var(--ht-card-h, 250px) + 76px);   /* room for the tilted side cards */
  margin-top: 4px;
  touch-action: pan-y;
}
html[data-layout="halftone"] .ht-deck .proj {
  /* The four poses a card can be in */
  --front: translateX(-50%);
  --right: translateX(calc(-50% + var(--ht-fan-x))) translateY(22px) rotate(8deg) scale(0.95);
  --left:  translateX(calc(-50% - var(--ht-fan-x))) translateY(26px) rotate(-10deg) scale(0.95);
  --off:   translateX(-50%) translateY(30px) scale(0.88);
  position: absolute; top: 12px; left: 50%;
  width: min(340px, 84%);
  min-height: var(--ht-card-h, 0);
  padding: 18px 20px 20px;
  background: var(--card);                 /* opaque: the cards overlap */
  transition:
    transform 520ms cubic-bezier(0.22, 0.8, 0.26, 1),
    opacity 320ms ease, box-shadow 320ms ease, border-color 200ms;
  will-change: transform;
  -webkit-user-select: none; user-select: none;
}
html[data-layout="halftone"] .ht-deck .proj > * { transition: opacity 320ms ease; }
html[data-layout="halftone"] .ht-deck .proj:not([data-pos="0"]) > * { opacity: 0.5; }

html[data-layout="halftone"] .ht-deck .proj[data-pos="0"] {
  transform: var(--front); z-index: 3;
  border-color: var(--border-strong);
  box-shadow: 0 26px 50px -24px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.06);
}
html[data-layout="halftone"] .ht-deck .proj[data-pos="1"]  { transform: var(--right); z-index: 2; }
html[data-layout="halftone"] .ht-deck .proj[data-pos="-1"] { transform: var(--left);  z-index: 1; }
html[data-layout="halftone"] .ht-deck .proj[data-pos="off"] {
  transform: var(--off); z-index: 0;
  opacity: 0; pointer-events: none;
}
/* Hover: the front card lifts, a side card slides out a little to invite the click */
html[data-layout="halftone"] .ht-deck .proj[data-pos="0"]:hover { transform: var(--front) translateY(-4px); }
html[data-layout="halftone"] .ht-deck .proj[data-pos="1"]:hover {
  transform: translateX(calc(-50% + var(--ht-fan-x) + 14px)) translateY(18px) rotate(9deg) scale(0.96);
}
html[data-layout="halftone"] .ht-deck .proj[data-pos="-1"]:hover {
  transform: translateX(calc(-50% - var(--ht-fan-x) - 14px)) translateY(22px) rotate(-11deg) scale(0.96);
}
html[data-layout="halftone"] .ht-deck .proj:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

/* Dealing a card: it swings out past its side, comes over the top, then lands in front */
html[data-layout="halftone"] .ht-deck .proj.ht-deal-r { animation: ht-deal-r 580ms cubic-bezier(0.4, 0, 0.2, 1) both; }
html[data-layout="halftone"] .ht-deck .proj.ht-deal-l { animation: ht-deal-l 580ms cubic-bezier(0.4, 0, 0.2, 1) both; }
@keyframes ht-deal-r {
  0%   { transform: var(--right); z-index: 2; }
  40%  { transform: translateX(calc(-50% + var(--ht-fan-x) + 92px)) translateY(-6px) rotate(13deg) scale(0.98); z-index: 2; }
  41%  { z-index: 5; }
  100% { transform: var(--front); z-index: 5; }
}
@keyframes ht-deal-l {
  0%   { transform: var(--left); z-index: 1; }
  40%  { transform: translateX(calc(-50% - var(--ht-fan-x) - 92px)) translateY(-6px) rotate(-13deg) scale(0.98); z-index: 1; }
  41%  { z-index: 5; }
  100% { transform: var(--front); z-index: 5; }
}

/* Card contents in the deck: tag pills, icon tile + pixel title, link pill */
html[data-layout="halftone"] .ht-proj-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
html[data-layout="halftone"] .ht-proj-tag {
  padding: 3px 9px;
  font-family: var(--ht-mono);
  font-size: 9.5px; line-height: 1.5; letter-spacing: 0.1em;
  text-transform: uppercase; white-space: nowrap;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}
html[data-layout="halftone"] .ht-proj-tag:first-child {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}
html[data-layout="halftone"] .ht-proj-tag:first-child::before { content: '\2039\00a0'; }
html[data-layout="halftone"] .ht-proj-tag:first-child::after  { content: '\00a0\203A'; }
html[data-layout="halftone"] .ht-proj-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
html[data-layout="halftone"] .ht-proj-icon {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  font-size: 17px;
  color: var(--bg);
  background: var(--text);
  border-radius: 10px;
}
html[data-layout="halftone"] .ht-deck .proj-name {
  display: block; margin: 0;
  font-family: var(--ht-pixel);
  font-size: 17px; font-weight: 400; line-height: 1.2;
}
html[data-layout="halftone"] .ht-deck .proj-name i { display: none; }
/* Capped at four lines: every card is as tall as the tallest one, so one long blurb
   would leave the rest with a big empty gap (worst on phones, where text wraps more) */
html[data-layout="halftone"] .ht-deck .proj-desc {
  margin: 0 0 16px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4; line-clamp: 4;
  overflow: hidden;
}
html[data-layout="halftone"] .ht-deck .proj-url,
html[data-layout="halftone"] .ht-deck .proj:hover .proj-url {
  padding: 7px 12px;
  color: var(--bg);
  background: var(--text);
  border-radius: 8px;
}
html[data-layout="halftone"] .ht-deck .proj-url::after { content: '\00a0\2197'; }
/* Title stacked over its user count, beside the icon tile */
html[data-layout="halftone"] .ht-proj-titles { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
html[data-layout="halftone"] .ht-proj-users {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--ht-mono); font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
html[data-layout="halftone"] .ht-proj-users i { font-size: 10px; }
html[data-layout="halftone"] .ht-proj-users b { font-weight: 500; color: var(--text); }

html[data-layout="halftone"] .ht-deck-bar {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font-family: var(--ht-mono);
  font-size: 11px; letter-spacing: 0.14em;
  color: var(--text-muted);
}
html[data-layout="halftone"] .ht-deck-bar button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  font-size: 10px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color 200ms, border-color 200ms;
}
html[data-layout="halftone"] .ht-deck-bar button:hover { color: var(--text); border-color: var(--border-strong); }
html[data-layout="halftone"] .ht-deck-bar button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
html[data-layout="halftone"] .ht-deck-count { min-width: 64px; text-align: center; }

@media (max-width: 559px) {
  html[data-layout="halftone"] .proj-grid.ht-deck { --ht-fan-x: 34px; }
  html[data-layout="halftone"] .ht-deck .proj { width: min(300px, 84%); }
}
@media (prefers-reduced-motion: reduce) {
  html[data-layout="halftone"] .ht-deck .proj,
  html[data-layout="halftone"] .ht-deck .proj > * { transition: none; }
  html[data-layout="halftone"] .ht-deck .proj.ht-deal-r,
  html[data-layout="halftone"] .ht-deck .proj.ht-deal-l { animation: none; }
}

/* --- 03 experience: year | title | organisation rows ------------------- */
html[data-layout="halftone"] .exp-list { border-bottom: 1px solid var(--border); }
html[data-layout="halftone"] .exp-item {
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: baseline;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
html[data-layout="halftone"] .exp-item::before,
html[data-layout="halftone"] .exp-mark { display: none; }
html[data-layout="halftone"] .exp-info { display: contents; }
html[data-layout="halftone"] .exp-year {
  order: -1;
  margin: 0;
  font-family: var(--ht-mono);
  font-size: 12px; font-weight: 400;
  color: var(--text-muted);
}
html[data-layout="halftone"] .exp-title { font-size: 15px; font-weight: 600; line-height: 1.4; }
html[data-layout="halftone"] .exp-hello { font-family: var(--ht-mono); font-size: 13px; }
html[data-layout="halftone"] .exp-org {
  margin: 0;
  font-size: 13.5px; line-height: 1.4;
  text-align: right;
}
@media (max-width: 559px) {
  html[data-layout="halftone"] .exp-item { grid-template-columns: 84px minmax(0, 1fr); }
  html[data-layout="halftone"] .exp-org { grid-column: 2; text-align: left; }
}

/* --- 04 stack ---------------------------------------------------------- */
html[data-layout="halftone"] .stack-group { margin-bottom: 22px; }
html[data-layout="halftone"] .stack-label,
html[data-layout="halftone"] .info-label {
  margin: 0 0 12px;
  font-family: var(--ht-mono);
  font-size: 11px; font-weight: 400; letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
html[data-layout="halftone"] .stack-chips { gap: 8px; }
html[data-layout="halftone"] .stack-chip {
  padding: 4px 10px;
  font-family: var(--ht-mono); font-size: 12px;
  color: var(--text-soft);
  background: var(--ht-raise);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: color 200ms, border-color 200ms;
}
html[data-layout="halftone"] .stack-chip:hover { color: var(--text); border-color: var(--border-strong); }

/* --- 05 certifications: three-up badge cards --------------------------- */
/* Icon on top, centred title, issuer in small caps, "‹ verify ›" that inks in on hover.
   The icon tile is added by js/halftone.js from each card's data-icon. */
html[data-layout="halftone"] .cert-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
html[data-layout="halftone"] .cert,
html[data-layout="halftone"] .cert:last-child,
html[data-layout="halftone"] .cert:hover {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 14px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
html[data-layout="halftone"] .cert { transition: border-color 200ms, transform 200ms, box-shadow 200ms; }
html[data-layout="halftone"] .cert:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: 0 18px 30px -20px rgba(0, 0, 0, 0.45);
}
/* The two halftone-only cards sit before the last item in the markup; show them last */
html[data-layout="halftone"] .cert.ht-only { order: 1; }
html[data-layout="halftone"] .ht-cert-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin-bottom: 14px;
  font-size: 16px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9px;
}
html[data-layout="halftone"] .cert-title { font-size: 13.5px; font-weight: 500; line-height: 1.35; }
html[data-layout="halftone"] .cert-org,
html[data-layout="halftone"] .cert::after {
  font-family: var(--ht-mono);
  font-size: 9.5px; letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
html[data-layout="halftone"] .cert-org { margin: 6px 0 16px; }
html[data-layout="halftone"] .cert::after {
  content: '\2039\00a0\00a0verify\00a0\00a0\203A';
  display: block; margin-top: auto;
  color: var(--text-faint);
  transition: color 200ms;
}
html[data-layout="halftone"] .cert:hover::after { color: var(--text); }

/* ==========================================================================
   TOUR: a guided walk-through. js/halftone.js drives a stand-in cursor from
   element to element and types a short line at each stop.
   ========================================================================== */
html[data-layout="halftone"] .ht-tour-cursor,
html[data-layout="halftone"] .ht-tour-bubble {
  position: fixed; top: 0; left: 0; z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 250ms ease;
  will-change: transform;
}
html[data-layout="halftone"] .ht-tour-on .ht-tour-cursor,
html[data-layout="halftone"] .ht-tour-on .ht-tour-bubble { opacity: 1; }
html[data-layout="halftone"] .ht-tour-cursor svg { display: block; width: 18px; height: 18px; }
html[data-layout="halftone"] .ht-tour-cursor path {
  fill: var(--text); stroke: var(--bg);
  stroke-width: 1.5; stroke-linejoin: round;
}
/* Inverted against the page so it reads as an overlay: light bubble on dark, dark on light */
html[data-layout="halftone"] .ht-tour-bubble {
  max-width: 250px;
  padding: 3px 9px;
  font-size: 12.5px; line-height: 1.45;
  color: var(--bg);
  background: var(--text);
  border-radius: 999px;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.5);
}
html[data-layout="halftone"] .ht-tour-name {
  display: block;
  font-family: var(--ht-mono);
  font-size: 10px; font-weight: 500;
}
/* While speaking: the name shrinks to a label above the line */
html[data-layout="halftone"] .ht-tour-bubble.is-speaking { padding: 7px 11px 8px; border-radius: 10px; }
html[data-layout="halftone"] .ht-tour-bubble.is-speaking .ht-tour-name { margin-bottom: 2px; font-size: 9px; opacity: 0.55; }
html[data-layout="halftone"] .ht-tour-text:empty { display: none; }
html[data-layout="halftone"] .ht-tour-bubble.is-typing .ht-tour-text::after {
  content: '';
  display: inline-block; width: 1px; height: 1em; margin-left: 1px;
  vertical-align: -0.15em;
  background: currentColor;
}

/* What the tour cursor is pointing at gets the same emphasis as a hover */
html[data-layout="halftone"] .ht-tour-hot,
html[data-layout="halftone"] .ht-tour-hot i,
html[data-layout="halftone"] .ht-figure.ht-tour-hot span { color: var(--text) !important; }

/* Bottom pill: "take the tour again" after a tour, "skip tour" during one */
html[data-layout="halftone"] .ht-tour-pill {
  position: fixed; bottom: 14px; left: 50%; z-index: 60;
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px 4px 3px 10px;
  font-family: var(--ht-mono);
  font-size: 10.5px; letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  transform: translateX(-50%);
}
html[data-layout="halftone"] .ht-tour-pill[hidden],
html[data-layout="halftone"] .ht-tour-pill button[hidden] { display: none; }
html[data-layout="halftone"] .ht-tour-pill button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 6px;
  font: inherit; color: inherit;
  background: none; border: 0; border-radius: 999px;
  cursor: pointer;
  transition: color 200ms;
}
html[data-layout="halftone"] .ht-tour-pill button:hover { color: var(--text); }
html[data-layout="halftone"] .ht-tour-pill button:focus-visible,
html[data-layout="halftone"] .ht-tour-start:focus-visible,
html[data-layout="halftone"] .ht-tt-open:focus-visible,
html[data-layout="halftone"] .ht-chat-open:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
html[data-layout="halftone"] .ht-tour-pill i { font-size: 9px; }
html[data-layout="halftone"] .ht-tour-start,
html[data-layout="halftone"] .ht-tt-open,
html[data-layout="halftone"] .ht-chat-open {
  padding: 0;
  font: inherit; color: inherit;
  background: none; border: 0;
  cursor: pointer;
  transition: color 200ms;
}
html[data-layout="halftone"] .ht-tour-start:hover,
html[data-layout="halftone"] .ht-tt-open:hover,
html[data-layout="halftone"] .ht-chat-open:hover { color: var(--text); }
html[data-layout="halftone"] .ht-keys .ht-kplus { margin-left: 4px; font-family: var(--ht-mono); font-size: 10px; }
html[data-layout="halftone"] .ht-keys .ht-kplus + kbd { margin-left: 4px; }
@media (min-width: 1024px) {
  /* centre the pill on the content column, not the whole window */
  html[data-layout="halftone"] .ht-tour-pill { left: calc(50% + var(--ht-side-w) / 2); }
}

/* --- 06 recommendations: all shown at once, long quotes clamp ---------- */
html[data-layout="halftone"] .rc-viewport {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
html[data-layout="halftone"] .rc-slide {
  display: flex !important;      /* the classic carousel hides inactive slides */
  flex-direction: column;
  padding: 18px;
  animation: none;
}
html[data-layout="halftone"] .rc-slide.ht-open { grid-column: 1 / -1; }
html[data-layout="halftone"] .rc-quote-icon { margin-bottom: 8px; font-size: 14px; }
html[data-layout="halftone"] .rc-quote {
  margin: 0 0 16px;
  font-family: var(--ht-serif);
  font-size: 14.5px; line-height: 1.6;
  color: var(--text);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5; line-clamp: 5;
  overflow: hidden;
}
html[data-layout="halftone"] .rc-slide.ht-open .rc-quote {
  display: block;
  -webkit-line-clamp: unset; line-clamp: unset;
  overflow: visible;
}
html[data-layout="halftone"] .ht-more {
  align-self: flex-start;
  margin: -6px 0 16px; padding: 0;
  font-family: var(--ht-mono);
  font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: none; border: 0;
  cursor: pointer;
  transition: color 200ms;
}
html[data-layout="halftone"] .ht-more:hover { color: var(--text); }
/* Pinned to the card's bottom edge so the three cards line up */
html[data-layout="halftone"] .rc-cite {
  margin-top: auto; padding-top: 14px;
  gap: 10px;
  border-top: 1px solid var(--border);
}
html[data-layout="halftone"] .rc-avatar {
  width: 30px; height: 30px;
  font-family: var(--ht-mono);
  font-size: 10px; font-weight: 500;
  background: var(--accent-soft);
}
html[data-layout="halftone"] .rc-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
html[data-layout="halftone"] .rc-role {
  margin-top: 3px;
  font-family: var(--ht-mono);
  font-size: 9.5px; letter-spacing: 0.1em;
  text-transform: uppercase;
}
html[data-layout="halftone"] .rc-name,
html[data-layout="halftone"] .rc-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-layout="halftone"] .rc-controls { display: none; }

@media (max-width: 719px) {
  html[data-layout="halftone"] .rc-viewport { grid-template-columns: minmax(0, 1fr); }
  html[data-layout="halftone"] .cert-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  /* The tour needs the sidebar and a mouse, so its controls are desktop-only */
  html[data-layout="halftone"] .ht-tour-pill { display: none; }
}

/* --- 07 github: dot-matrix contribution graph + latest repos ----------- */
html[data-layout="halftone"] .ht-gh-graph svg {
  display: block; width: 100%; height: auto;
  color: var(--text);
}
html[data-layout="halftone"] .ht-gh-total {
  margin: 14px 0 28px;
  font-family: var(--ht-mono);
  font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
html[data-layout="halftone"] .ht-gh-repos { border-bottom: 1px solid var(--border); }
html[data-layout="halftone"] .ht-repo {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}
html[data-layout="halftone"] .ht-repo-name {
  min-width: 0;
  font-size: 15px; font-weight: 500;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity 200ms;
}
html[data-layout="halftone"] .ht-repo:hover .ht-repo-name { opacity: 0.6; }
html[data-layout="halftone"] .ht-repo-meta {
  flex-shrink: 0;
  font-family: var(--ht-mono); font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- 08 contact -------------------------------------------------------- */
html[data-layout="halftone"] .info-row { gap: 28px 24px; }
html[data-layout="halftone"] .info-item,
html[data-layout="halftone"] .info-item-stacked .value-line,
html[data-layout="halftone"] .info-item-row .value-line { font-size: 14px; }
html[data-layout="halftone"] .info-item-stacked .label-line { margin-top: 6px; font-size: 13px; line-height: 1.55; }
html[data-layout="halftone"] .info-item-row .label-line {
  font-family: var(--ht-mono);
  font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
html[data-layout="halftone"] .info-item-row .value-line { overflow-wrap: anywhere; }

/* --- footer ------------------------------------------------------------ */
html[data-layout="halftone"] .footer-copy {
  margin-top: 88px; padding: 24px 0 0;
  font-family: var(--ht-mono); font-size: 11px;
  text-align: left;
}

@media (prefers-reduced-motion: reduce) {
  html[data-layout="halftone"] .proj,
  html[data-layout="halftone"] .cert { transition: none; transform: none; }
}

/* ==========================================================================
   PHONES: tighter rhythm, full-width portrait, compact certificate rows
   ========================================================================== */
@media (max-width: 719px) {
  html[data-layout="halftone"] .hero { padding-bottom: 40px; }
  /* Portrait spans the text column so its edges line up with the copy below */
  html[data-layout="halftone"] .ht-portrait { max-width: 360px; }
  html[data-layout="halftone"] .card { margin-top: 64px !important; }
  html[data-layout="halftone"] .card-title { margin-bottom: 20px; }
  html[data-layout="halftone"] .footer-copy { margin-top: 64px; }
}
@media (max-width: 559px) {
  /* Certificates: one row each (icon | title + issuer | verify) instead of tall cards */
  html[data-layout="halftone"] .cert-list { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  html[data-layout="halftone"] .cert,
  html[data-layout="halftone"] .cert:last-child,
  html[data-layout="halftone"] .cert:hover {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    column-gap: 12px;
    align-items: center;
    padding: 12px 14px;
    text-align: left;
  }
  html[data-layout="halftone"] .ht-cert-icon {
    grid-column: 1; grid-row: 1 / span 2;
    width: 34px; height: 34px; margin: 0;
    font-size: 14px;
  }
  html[data-layout="halftone"] .cert-title { grid-column: 2; }
  html[data-layout="halftone"] .cert-org { grid-column: 2; margin: 3px 0 0; letter-spacing: 0.04em; }
  html[data-layout="halftone"] .cert::after {
    grid-column: 3; grid-row: 1 / span 2;
    margin: 0;
    content: 'verify\00a0\203A';
  }
}

/* ==========================================================================
   TYPING TEST (js/halftone.js): Alt+J, or "Typing test" in the sidebar
   ========================================================================== */
html[data-layout="halftone"].ht-tt-lock { overflow: hidden; }
html[data-layout="halftone"] .ht-tt {
  --tt-veil: rgba(250, 250, 250, 0.84);
  --tt-todo: #c9c9c9;
  --tt-bad:  #d9483f;
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 24px;
  outline: none;
}
html[data-layout="halftone"][data-theme="dark"] .ht-tt {
  --tt-veil: rgba(12, 12, 15, 0.9);
  --tt-todo: #4b4b53;
  --tt-bad:  #f2736a;
}
html[data-layout="halftone"] .ht-tt[hidden] { display: none; }

html[data-layout="halftone"] .ht-tt-veil {
  position: absolute; inset: 0;
  background: var(--tt-veil);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 300ms ease;
}
html[data-layout="halftone"] .ht-tt-body {
  position: relative;
  width: 100%; max-width: 860px;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  opacity: 0; transform: translateY(14px);
  transition: opacity 340ms ease 40ms, transform 480ms cubic-bezier(0.16, 1, 0.3, 1) 40ms;
}
html[data-layout="halftone"] .ht-tt.is-open .ht-tt-veil,
html[data-layout="halftone"] .ht-tt.is-open .ht-tt-body { opacity: 1; transform: none; }

/* Live numbers + result numbers */
html[data-layout="halftone"] .ht-tt-stats,
html[data-layout="halftone"] .ht-tt-grid { display: flex; gap: 44px; font-family: var(--ht-mono); }
html[data-layout="halftone"] .ht-tt-stats > div,
html[data-layout="halftone"] .ht-tt-grid > div { display: flex; flex-direction: column; align-items: center; gap: 7px; }
html[data-layout="halftone"] .ht-tt-stats b,
html[data-layout="halftone"] .ht-tt-grid b {
  min-width: 3ch; text-align: center;
  font-size: 28px; font-weight: 500; line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
html[data-layout="halftone"] .ht-tt-grid b { font-size: 24px; }
html[data-layout="halftone"] .ht-tt-stats b i,
html[data-layout="halftone"] .ht-tt-grid b i {
  margin-left: 2px;
  font-style: normal; font-size: 13px;
  color: var(--text-faint);
}
html[data-layout="halftone"] .ht-tt-stats > div > span,
html[data-layout="halftone"] .ht-tt-grid > div > span,
html[data-layout="halftone"] .ht-tt-cap {
  font-family: var(--ht-mono);
  font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-faint);
}

/* The words: three lines show; the block slides up as the caret moves down */
html[data-layout="halftone"] .ht-tt-text { width: 100%; height: 120px; overflow: hidden; }
html[data-layout="halftone"] .ht-tt-lines {
  position: relative;
  font-family: var(--ht-pixel);
  font-size: 24px; line-height: 40px; letter-spacing: 0.02em;
  color: var(--tt-todo);
  -webkit-user-select: none; user-select: none;
  transition: transform 220ms ease;
}
html[data-layout="halftone"] .ht-tt-word { display: inline-block; margin-right: 0.55em; white-space: nowrap; }
html[data-layout="halftone"] .ht-tt-word span { transition: color 90ms ease; }
html[data-layout="halftone"] .ht-tt-word .is-ok    { color: var(--text); }
html[data-layout="halftone"] .ht-tt-word .is-bad   { color: var(--tt-bad); }
html[data-layout="halftone"] .ht-tt-word .is-extra { color: var(--tt-bad); opacity: 0.55; }
html[data-layout="halftone"] .ht-tt-word.is-wrong {
  text-decoration: underline 1.5px var(--tt-bad);
  text-underline-offset: 7px;
}
html[data-layout="halftone"] .ht-tt-caret {
  position: absolute; top: 0; left: 0;
  width: 2px; height: 28px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 110ms cubic-bezier(0.16, 1, 0.3, 1);
  animation: ht-tt-blink 1s ease-in-out infinite;
}
html[data-layout="halftone"] .ht-tt.is-typing .ht-tt-caret { animation: none; }

/* On-screen keyboard: the next key is outlined, pressed keys dip */
html[data-layout="halftone"] .ht-tt-board { display: flex; flex-direction: column; align-items: center; gap: 7px; }
html[data-layout="halftone"] .ht-tt-row { display: flex; gap: 7px; }
html[data-layout="halftone"] .ht-tt-key {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 8px;
  font-family: var(--ht-mono); font-size: 12px;
  color: var(--text-muted);
  background: var(--ht-raise);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 2px 0 var(--border);
  transition: transform 90ms ease, box-shadow 90ms ease, background-color 90ms ease, color 120ms ease, border-color 120ms ease;
}
html[data-layout="halftone"] .ht-tt-key.is-space {
  min-width: 240px;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint);
}
html[data-layout="halftone"] .ht-tt-key.is-next {
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 2px 0 var(--border-strong);
}
html[data-layout="halftone"] .ht-tt-key.is-down {
  color: var(--text);
  background: var(--card-soft);
  transform: translateY(2px);
  box-shadow: 0 0 0 transparent;
}
html[data-layout="halftone"] .ht-tt.is-open .ht-tt-key {
  animation: ht-tt-in 400ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: calc(var(--i, 0) * 7ms);
}

/* Hints, restart confirmation */
html[data-layout="halftone"] .ht-tt-hint,
html[data-layout="halftone"] .ht-tt-confirm {
  display: flex; align-items: center; gap: 18px;
  margin: 0;
  font-family: var(--ht-mono); font-size: 11px;
  color: var(--text-faint);
}
html[data-layout="halftone"] .ht-tt-hint span { display: inline-flex; align-items: center; gap: 7px; }
html[data-layout="halftone"] .ht-tt kbd {
  padding: 1px 6px;
  font-family: var(--ht-mono); font-size: 10.5px;
  color: var(--text-muted);
  background: var(--ht-raise);
  border: 1px solid var(--border);
  border-radius: 5px;
}
html[data-layout="halftone"] .ht-tt-confirm {
  display: none; gap: 8px;
  padding: 8px 14px;
  color: var(--text);
  background: var(--card-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
}
html[data-layout="halftone"] .ht-tt.is-confirming .ht-tt-confirm { display: flex; animation: ht-tt-in 240ms ease both; }
html[data-layout="halftone"] .ht-tt.is-confirming .ht-tt-hint { display: none; }

/* Result card */
html[data-layout="halftone"] .ht-tt-result { display: none; flex-direction: column; align-items: center; gap: 24px; }
html[data-layout="halftone"] .ht-tt.is-result .ht-tt-result { display: flex; animation: ht-tt-in 500ms cubic-bezier(0.16, 1, 0.3, 1) both; }
html[data-layout="halftone"] .ht-tt.is-result .ht-tt-stats,
html[data-layout="halftone"] .ht-tt.is-result .ht-tt-text,
html[data-layout="halftone"] .ht-tt.is-result .ht-tt-board { display: none; }
html[data-layout="halftone"] .ht-tt.is-result .ht-tt-hint { order: -1; }
html[data-layout="halftone"] .ht-tt-main { display: flex; flex-direction: column; align-items: center; gap: 10px; }
html[data-layout="halftone"] .ht-tt-big {
  font-family: var(--ht-pixel);
  font-size: 80px; font-weight: 400; line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
html[data-layout="halftone"] .ht-tt-cap { font-size: 11px; letter-spacing: 0.16em; }
html[data-layout="halftone"] .ht-tt-verdict {
  display: inline-flex; align-items: center; gap: 9px;
  margin: 0;
  font-family: var(--ht-mono); font-size: 12.5px; letter-spacing: 0.03em;
  color: var(--text-faint);
}
html[data-layout="halftone"] .ht-tt-verdict i { font-size: 11px; opacity: 0.7; }
html[data-layout="halftone"] .ht-tt-verdict.is-beat {
  font-family: var(--ht-pixel); font-size: 15px; letter-spacing: 0.01em;
  color: var(--text);
  animation: ht-tt-pop 600ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
html[data-layout="halftone"] .ht-tt-verdict.is-beat i { opacity: 1; }
html[data-layout="halftone"] .ht-tt-again {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  font-family: var(--ht-mono); font-size: 12px;
  color: var(--bg);
  background: var(--text);
  border: 0; border-radius: 10px;
  cursor: pointer;
  transition: transform 200ms ease, opacity 200ms ease;
}
html[data-layout="halftone"] .ht-tt-again:hover { transform: translateY(-1px); opacity: 0.88; }
html[data-layout="halftone"] .ht-tt-again:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
html[data-layout="halftone"] .ht-tt-again i { font-size: 11px; }

@keyframes ht-tt-in    { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ht-tt-pop   { 0% { opacity: 0; transform: scale(0.7); } 60% { transform: scale(1.06); } 100% { opacity: 1; transform: none; } }
@keyframes ht-tt-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.15; } }

@media (max-width: 719px) {
  html[data-layout="halftone"] .ht-tt-body { gap: 22px; }
  html[data-layout="halftone"] .ht-tt-stats,
  html[data-layout="halftone"] .ht-tt-grid { gap: 26px; }
  html[data-layout="halftone"] .ht-tt-text { height: 102px; }
  html[data-layout="halftone"] .ht-tt-lines { font-size: 20px; line-height: 34px; }
  html[data-layout="halftone"] .ht-tt-caret { height: 24px; }
  html[data-layout="halftone"] .ht-tt-board { display: none; }
  html[data-layout="halftone"] .ht-tt-big { font-size: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-layout="halftone"] .ht-tt-veil,
  html[data-layout="halftone"] .ht-tt-body,
  html[data-layout="halftone"] .ht-tt-lines,
  html[data-layout="halftone"] .ht-tt-caret,
  html[data-layout="halftone"] .ht-tt-key { transition: none; }
  html[data-layout="halftone"] .ht-tt-caret,
  html[data-layout="halftone"] .ht-tt.is-open .ht-tt-key,
  html[data-layout="halftone"] .ht-tt.is-result .ht-tt-result,
  html[data-layout="halftone"] .ht-tt.is-confirming .ht-tt-confirm,
  html[data-layout="halftone"] .ht-tt-verdict.is-beat { animation: none; }
}

/* ==========================================================================
   LIVE CHAT: random Taglish compliments in a corner panel (js/halftone.js).
   Open beside the column on wide screens; a small pill everywhere else.
   ========================================================================== */
html[data-layout="halftone"] .ht-chat {
  --chat-live: #e5484d;
  position: fixed; right: 16px; bottom: 14px; z-index: 70;
  display: flex; flex-direction: column; align-items: flex-end;
  font-size: 13px;
}

/* Minimised: pill with an unread count */
html[data-layout="halftone"] .ht-chat-pill {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px 0 12px;
  font-family: var(--ht-mono); font-size: 11px; letter-spacing: 0.03em;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 10px 28px -14px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: border-color 200ms, transform 200ms;
}
html[data-layout="halftone"] .ht-chat-pill:hover { border-color: var(--border-strong); transform: translateY(-1px); }
html[data-layout="halftone"] .ht-chat-pill i { font-size: 13px; }
html[data-layout="halftone"] .ht-chat-unread {
  position: absolute; top: -6px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; line-height: 1;
  color: var(--bg); background: var(--text);
  border: 2px solid var(--bg);
  border-radius: 999px;
  animation: ht-chat-pop 300ms ease;
}
html[data-layout="halftone"] .ht-chat-unread[hidden] { display: none; }
html[data-layout="halftone"] .ht-chat.is-open .ht-chat-pill { display: none; }

/* Open: the panel */
html[data-layout="halftone"] .ht-chat-panel {
  display: none; flex-direction: column;
  width: 300px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 22px 48px -22px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
html[data-layout="halftone"] .ht-chat.is-open .ht-chat-panel {
  display: flex;
  animation: ht-chat-rise 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
html[data-layout="halftone"] .ht-chat-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 8px 10px 14px;
  font-family: var(--ht-mono); font-size: 11px; letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}
html[data-layout="halftone"] .ht-chat-live {
  position: relative;
  width: 7px; height: 7px; flex-shrink: 0;
  background: var(--chat-live);
  border-radius: 50%;
}
html[data-layout="halftone"] .ht-chat-live::after {
  content: '';
  position: absolute; inset: -3px;
  border: 1.5px solid var(--chat-live);
  border-radius: 50%;
  animation: ht-chat-ping 1.8s ease-out infinite;
}
html[data-layout="halftone"] .ht-chat-title { font-weight: 500; color: var(--text); }
html[data-layout="halftone"] .ht-chat-here { color: var(--text-muted); }
html[data-layout="halftone"] .ht-chat-here::before { content: '·'; margin-right: 8px; }
html[data-layout="halftone"] .ht-chat-min {
  margin-left: auto;
  width: 28px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  background: none; border: 0; border-radius: 7px;
  cursor: pointer;
  transition: color 200ms, background 200ms;
}
html[data-layout="halftone"] .ht-chat-min:hover { color: var(--text); background: var(--card-soft); }
html[data-layout="halftone"] .ht-chat-pill:focus-visible,
html[data-layout="halftone"] .ht-chat-min:focus-visible,
html[data-layout="halftone"] .ht-chat-list:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

html[data-layout="halftone"] .ht-chat-list {
  height: 248px; margin: 0; padding: 14px 14px 4px;
  list-style: none;
  display: flex; flex-direction: column;   /* newest at the bottom, like a real chat */
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28px);
          mask-image: linear-gradient(to bottom, transparent 0, #000 28px);
}
html[data-layout="halftone"] .ht-chat-msg { display: flex; gap: 10px; flex-shrink: 0; }
html[data-layout="halftone"] .ht-chat-msg:first-child { margin-top: auto; }
html[data-layout="halftone"] .ht-chat-msg + .ht-chat-msg { margin-top: 12px; }
html[data-layout="halftone"] .ht-chat-msg.is-new { animation: ht-chat-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1); }
html[data-layout="halftone"] .ht-chat-av {
  width: 24px; height: 24px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px;
  color: var(--text);
  background: var(--card-soft);
  border-radius: 50%;
}
html[data-layout="halftone"] .ht-chat-body { min-width: 0; }
html[data-layout="halftone"] .ht-chat-name {
  display: block;
  font-family: var(--ht-mono); font-size: 10.5px; line-height: 1.3;
  color: var(--text-muted);
}
html[data-layout="halftone"] .ht-chat-text {
  margin: 1px 0 0;
  font-size: 13px; line-height: 1.45;
  color: var(--text);
  overflow-wrap: anywhere;
}

html[data-layout="halftone"] .ht-chat-typing {
  display: flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 14px;
  font-family: var(--ht-mono); font-size: 10px;
  color: var(--text-faint);
  opacity: 0;
  transition: opacity 200ms;
}
html[data-layout="halftone"] .ht-chat-typing.is-on { opacity: 1; }
html[data-layout="halftone"] .ht-chat-dots { display: inline-flex; gap: 3px; }
html[data-layout="halftone"] .ht-chat-dots i {
  width: 4px; height: 4px;
  background: currentColor;
  border-radius: 50%;
  animation: ht-chat-dot 1s ease-in-out infinite;
}
html[data-layout="halftone"] .ht-chat-dots i:nth-child(2) { animation-delay: 0.15s; }
html[data-layout="halftone"] .ht-chat-dots i:nth-child(3) { animation-delay: 0.3s; }
/* Type box: name (remembered per device) + message */
html[data-layout="halftone"] .ht-chat-form {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 10px 8px;
  border-top: 1px solid var(--border);
}
html[data-layout="halftone"] .ht-chat-form[hidden],
html[data-layout="halftone"] .ht-chat-namerow[hidden],
html[data-layout="halftone"] .ht-chat-as[hidden] { display: none; }
html[data-layout="halftone"] .ht-chat-namerow {
  display: flex; align-items: center; gap: 8px;
  padding: 0 4px;
}
html[data-layout="halftone"] .ht-chat-label {
  font-family: var(--ht-mono); font-size: 10px; letter-spacing: 0.04em;
  color: var(--text-muted);
}
html[data-layout="halftone"] .ht-chat-as {
  padding: 0 4px;
  font-family: var(--ht-mono); font-size: 10px;
  color: var(--text-muted);
}
html[data-layout="halftone"] .ht-chat-as b { font-weight: 500; color: var(--text); }
html[data-layout="halftone"] .ht-chat-change {
  margin-left: 6px; padding: 0;
  font: inherit; color: var(--text-faint);
  background: none; border: 0;
  text-decoration: underline; text-underline-offset: 2px;
  cursor: pointer;
}
html[data-layout="halftone"] .ht-chat-change:hover { color: var(--text); }
html[data-layout="halftone"] .ht-chat-name-input,
html[data-layout="halftone"] .ht-chat-input {
  min-width: 0;
  font: inherit; font-size: 13px;
  color: var(--text);
  background: var(--card-soft);
  border: 1px solid transparent;
  border-radius: 9px;
  outline: none;
  transition: border-color 200ms, background 200ms;
}
html[data-layout="halftone"] .ht-chat-name-input { flex: 1; height: 28px; padding: 0 9px; }
html[data-layout="halftone"] .ht-chat-input { flex: 1; height: 36px; padding: 0 11px; }
html[data-layout="halftone"] .ht-chat-name-input::placeholder,
html[data-layout="halftone"] .ht-chat-input::placeholder { color: var(--text-faint); }
html[data-layout="halftone"] .ht-chat-name-input:focus,
html[data-layout="halftone"] .ht-chat-input:focus { background: var(--bg); border-color: var(--border-strong); }
html[data-layout="halftone"] .ht-chat-row { display: flex; gap: 6px; }
html[data-layout="halftone"] .ht-chat-send {
  width: 36px; height: 36px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px;
  color: var(--bg); background: var(--text);
  border: 0; border-radius: 9px;
  cursor: pointer;
  transition: opacity 200ms, transform 200ms;
}
html[data-layout="halftone"] .ht-chat-send:hover { transform: translateY(-1px); }
html[data-layout="halftone"] .ht-chat-send:disabled { opacity: 0.45; cursor: progress; transform: none; }
html[data-layout="halftone"] .ht-chat-send:focus-visible,
html[data-layout="halftone"] .ht-chat-change:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
html[data-layout="halftone"] .ht-chat-foot {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 0 4px;
  font-family: var(--ht-mono); font-size: 10px; line-height: 1.4;
  color: var(--text-muted);
}
html[data-layout="halftone"] .ht-chat-foot:has(.ht-chat-err:empty):has(.ht-chat-count:empty) { display: none; }
html[data-layout="halftone"] .ht-chat-err { margin: 0; }
html[data-layout="halftone"] .ht-chat-err.is-error { color: #d9483f; }
html[data-layout="halftone"][data-theme="dark"] .ht-chat-err.is-error { color: #f2736a; }
html[data-layout="halftone"] .ht-chat-count { margin-left: auto; color: var(--text-faint); }

/* Real people: the owner's replies carry a check; your own lines are marked */
html[data-layout="halftone"] .ht-chat-name.is-owner { color: var(--text); font-weight: 500; }
html[data-layout="halftone"] .ht-chat-name.is-owner i { margin-left: 4px; font-size: 9px; }
html[data-layout="halftone"] .ht-chat-msg.is-mine .ht-chat-av { color: var(--bg); background: var(--text); }

@keyframes ht-chat-in   { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ht-chat-rise { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes ht-chat-pop  { from { transform: scale(0.4); } 60% { transform: scale(1.15); } to { transform: none; } }
@keyframes ht-chat-ping { from { opacity: 0.7; transform: scale(0.6); } to { opacity: 0; transform: scale(1.7); } }
@keyframes ht-chat-dot  { 0%, 60%, 100% { transform: none; opacity: 0.5; } 30% { transform: translateY(-3px); opacity: 1; } }

/* Phones: a round button that opens a sheet along the bottom */
@media (max-width: 719px) {
  html[data-layout="halftone"] .ht-chat { right: 14px; bottom: 14px; }
  html[data-layout="halftone"] .ht-chat-pill { width: 40px; height: 40px; padding: 0; justify-content: center; }
  html[data-layout="halftone"] .ht-chat-pill-label { display: none; }
  html[data-layout="halftone"] .ht-chat.is-open { left: 12px; right: 12px; bottom: 12px; }
  html[data-layout="halftone"] .ht-chat-panel { width: 100%; }
  html[data-layout="halftone"] .ht-chat-list { height: min(200px, 30vh); }
  /* 16px stops iPhones zooming the page when an input gets focus */
  html[data-layout="halftone"] .ht-chat-name-input,
  html[data-layout="halftone"] .ht-chat-input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-layout="halftone"] .ht-chat-pill,
  html[data-layout="halftone"] .ht-chat-typing,
  html[data-layout="halftone"] .ht-chat-send { transition: none; }
  html[data-layout="halftone"] .ht-chat-unread,
  html[data-layout="halftone"] .ht-chat.is-open .ht-chat-panel,
  html[data-layout="halftone"] .ht-chat-msg.is-new,
  html[data-layout="halftone"] .ht-chat-live::after,
  html[data-layout="halftone"] .ht-chat-dots i { animation: none; }
}
