/* hey.benmor.me · Ai-zome 藍染 — indigo dye, kinari cloth, kincha gold */

/* ---------- Fonts (self-hosted, Latin subset) ---------- */
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/fraunces-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/fraunces-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/inter-tight-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/inter-tight-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/inter-tight-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  --bg: #f6f1e7;
  --tile: #fffcf5;
  --ink: #1d2a44;
  --mute: #6d6a62;
  --line: #e5dccb;
  --hero: #22396b;
  --hero-ink: #f6f1e7;
  --hero-mute: #c9d1e6;
  --accent: #e3a23b;
  --accent-ink: #1d2a44;
  --accent-text: #986310;
  --indigo-2: #2f4f8a;
  --icon: #2f4f8a;
  --placeholder: #efe7d6;
  --shadow: #1d2a44;

  --radius: 14px;
  --gap: 14px;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121a2e;
    --tile: #1b2540;
    --ink: #eef0f6;
    --mute: #a3abc2;
    --line: #2a3658;
    --accent-text: #e3a23b;
    --indigo-2: #3a5fa3;
    --icon: #9fb4e3;
    --placeholder: #222d4c;
    --shadow: #000000;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; text-align: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Grid ---------- */
/* Phone: one column of full-width tiles. */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}
.grid > * { grid-column: 1 / -1; }

/* ---------- Tiles ---------- */
.tile {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: var(--tile);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
a.tile { cursor: pointer; }

.label {
  font: 500 .6875rem/1.3 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mute);
}

/* Intro */
.tile--hero {
  --pad: 22px;
  padding: var(--pad);
  gap: 14px;
  background:
    radial-gradient(120% 80% at 0% 100%, #1a2d57 0%, transparent 60%),
    var(--hero);
  color: var(--hero-ink);
  border-color: var(--hero);
  isolation: isolate;
}
/* Dye ripples in the corner, like rings in an indigo vat. */
.tile--hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -40px;
  top: -40px;
  width: 300px;
  height: 300px;
  background: repeating-radial-gradient(circle at 100% 0%, transparent 0 17px, rgb(246 241 231 / .07) 17px 18px);
  -webkit-mask-image: radial-gradient(circle at 100% 0%, #000 30%, transparent 72%);
  mask-image: radial-gradient(circle at 100% 0%, #000 30%, transparent 72%);
  pointer-events: none;
}
.name {
  font: 700 clamp(2.25rem, 1.6rem + 3vw, 3.5rem)/1 var(--serif);
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}
.role {
  font-weight: 600;
  font-size: .9375rem;
  line-height: 1.4;
  color: var(--hero-mute);
}
.headline {
  font: 600 clamp(1.3rem, 1.05rem + 1.1vw, 1.75rem)/1.22 var(--serif);
  letter-spacing: -.012em;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.headline .accent { font-style: normal; color: var(--accent); }
.status {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgb(246 241 231 / .16);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.4;
}
.dot {
  position: relative;
  top: -1px;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgb(227 162 59 / .55); }
  70%, 100% { box-shadow: 0 0 0 9px rgb(227 162 59 / 0); }
}

/* Contact: one tile, three equal buttons (CV · Email · LinkedIn). */
.tile--contact { padding: 10px; }
.contact-row {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.contact-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 76px;
  margin: 0;
  padding: 12px 6px;
  background: var(--tile);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: 600 .9375rem/1.1 var(--sans);
  letter-spacing: -.01em;
  text-align: center;
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease), background-color .25s var(--ease);
}
.contact-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.contact-btn .icon { flex: none; width: 24px; height: 24px; transition: translate .25s var(--ease); }
.contact-label { min-width: 0; overflow-wrap: break-word; }
.contact-btn--cv { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* Dye ripples in the CV button's corner, echoing the intro tile. */
.contact-btn--cv::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -1px -1px auto auto;
  width: 160px;
  height: 160px;
  background: repeating-radial-gradient(circle at 100% 0%, transparent 0 11px, rgb(29 42 68 / .08) 11px 12px);
  -webkit-mask-image: radial-gradient(circle at 100% 0%, #000 25%, transparent 70%);
  mask-image: radial-gradient(circle at 100% 0%, #000 25%, transparent 70%);
  pointer-events: none;
}
.contact-btn--email .icon, .contact-btn--linkedin .icon { color: var(--icon); }
.contact-btn--email.is-copied { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
@media (max-width: 379px) {
  .grid { gap: 10px; }
  .contact-row { gap: 6px; }
  .contact-btn { font-size: .875rem; }
}

/* JS-only pieces (copy button, clock) are hidden under @media (scripting: none), see the end of the grid rules.
   The clock is also hidden on phones (spec phone order omits it). */
.tile--clock { display: none; }
/* With JS off the <noscript> itself becomes the contact grid item; its link fills it.
   (Never give noscript a display value: Chromium would then render its raw text with JS on.) */
.contact-row > noscript > .contact-btn { height: 100%; }

/* Clock (shown from tablet up) */
.tile--clock { justify-content: space-between; }
.clock {
  font: 500 clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem)/1 var(--mono);
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

/* Toast: fixed, never takes a grid cell. */
#email-toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  translate: -50% 0;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: .875rem;
  box-shadow: 0 10px 30px -10px rgb(0 0 0 / .45);
  /* The live region stays rendered so screen readers keep it; app.js toggles .is-shown. */
  opacity: 0;
  visibility: hidden;
  translate: -50% 8px;
  pointer-events: none;
  transition: opacity .25s var(--ease), translate .25s var(--ease), visibility 0s linear .25s;
}
#email-toast.is-shown {
  opacity: 1;
  visibility: visible;
  translate: -50% 0;
  pointer-events: auto;
  transition: opacity .25s var(--ease), translate .25s var(--ease), visibility 0s;
}
#email-toast a { text-decoration: underline; text-underline-offset: 3px; margin-left: 8px; }

/* Projects */
/* Section heading above the project tiles: a full grid row, same type as the Experience label. */
.grid > .section-label { grid-column: 1 / -1; }
.section-label {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 2px 0;
  color: var(--accent-text);
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.project { padding-top: 0; gap: 8px; }
/* Logo badge + label on one row. */
.project-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.project-logo {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: contain;
}
/* The rosette is a bare mark (transparent, no shape): sit it on a cream plate so it reads as a badge like the app icons. */
.tile--mor .project-logo {
  padding: 3px;
  background: #fffcf5;
  box-shadow: 0 0 0 1px rgb(29 42 68 / .1);
}
.shot {
  display: block;
  margin: 0 -18px 8px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background:
    linear-gradient(135deg, transparent 0 48%, rgb(127 127 127 / .08) 48% 52%, transparent 52%) 0 0 / 14px 14px,
    var(--placeholder);
  border-bottom: 1px solid var(--line);
}
.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  color: transparent; /* hide alt text of a missing image; the placeholder shows instead */
  transition: scale .5s var(--ease);
}
.project .title {
  font: 600 1.25rem/1.2 var(--serif);
  letter-spacing: -.012em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.project .line { font-size: .9375rem; line-height: 1.5; overflow-wrap: anywhere; }
.project .tags {
  margin-top: auto;
  padding-top: 8px;
  font: 500 .6875rem/1.3 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.project .line, .project .tags { color: var(--mute); }

.tile--yeshuvim { background: var(--indigo-2); color: var(--hero-ink); border-color: var(--indigo-2); }
.tile--yeshuvim .shot { --placeholder: rgb(0 0 0 / .14); border-color: rgb(246 241 231 / .14); }
.tile--yeshuvim .label,
.tile--yeshuvim .line,
.tile--yeshuvim .tags { color: var(--hero-ink); }

.tile--benfit .label { color: var(--accent-text); }

.tile--mor { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tile--mor .shot { --placeholder: rgb(29 42 68 / .1); border-color: rgb(29 42 68 / .14); }
.tile--mor .label,
.tile--mor .line,
.tile--mor .tags { color: var(--accent-ink); }

/* Experience + education */
.tile--exp { gap: 12px; padding: 20px 18px; }
.tile--exp .label { color: var(--accent-text); }
.tile--exp .label + .edu-list { margin-top: -2px; }
.exp-list { display: grid; }
.exp-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 2px 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.exp-row:last-child { border-bottom: 1px solid var(--line); }
.exp-row dt { font-weight: 600; font-size: .9375rem; line-height: 1.35; min-width: 0; overflow-wrap: anywhere; }
.exp-row dd {
  font: 500 .75rem/1.35 var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--mute);
  white-space: nowrap;
}
.tile--exp h2.label:nth-of-type(2) { margin-top: 10px; }
.edu-list { display: grid; gap: 8px; font-size: .9375rem; line-height: 1.45; color: var(--mute); }
.edu-list strong { font-weight: 600; color: var(--ink); }

/* Footer */
.footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 16px 40px;
  font: 500 .6875rem/1.4 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mute);
  text-align: center;
}

/* ---------- Tablet: 2 columns ---------- */
@media (min-width: 640px) {
  /* Two visual columns on a 6-track grid, so the contact row can split 2:1 (contact wide, clock beside it). */
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 24px; }
  .grid > .tile--contact { grid-column: span 4; }
  .grid > .tile--clock { grid-column: span 2; }
  .grid > .project { grid-column: span 3; }
  .grid > .tile--yeshuvim { grid-column: 1 / -1; }

  .tile--hero { --pad: 28px; }
  .tile--clock { display: flex; padding: 18px; min-height: 120px; }

  .tile--contact { min-height: 120px; }
  .contact-btn {
    align-items: flex-start;
    justify-content: space-between;
    padding: 14px;
    text-align: left;
    font: 600 1.125rem/1.1 var(--serif);
    letter-spacing: -.012em;
  }
  /* From tablet up the icon sits on a soft chip, top-left, with the label at the foot (like the other tiles). */
  .contact-btn .icon {
    width: 44px;
    height: 44px;
    padding: 10px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--indigo-2) 11%, transparent);
  }
  .contact-btn--cv .icon { background: rgb(29 42 68 / .1); }

  .project { padding: 0 20px 20px; }
  .shot { margin: 0 -20px 10px; }
  .tile--yeshuvim .shot { aspect-ratio: 16 / 7; }
  .tile--exp { padding: 24px; }
}

/* ---------- Desktop: 4 columns, explicit placement (spec §3) ---------- */
@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 40px 24px 24px; }
  .grid > .tile--hero { grid-column: 1 / span 2; grid-row: 1 / span 2; }
  .grid > .tile--contact { grid-column: 3 / span 2; grid-row: 1; }
  .grid > .tile--clock { grid-column: 3 / span 2; grid-row: 2; }
  .grid > .project { grid-column: span 1; }
  .grid > .tile--yeshuvim { grid-column: span 2; }
  .grid > .tile--exp { grid-column: span 4; }

  .tile--hero { --pad: 32px; gap: 16px; }
  .tile--contact { padding: 12px; }
  .contact-row { gap: 10px; }
  .contact-btn { padding: 18px; font-size: 1.375rem; }
  .contact-btn .icon { width: 52px; height: 52px; padding: 12px; border-radius: 12px; }

  .project-logo { width: 32px; height: 32px; }

  /* One shared screenshot height so the wide Yeshuvim tile lines up with its neighbours. */
  .project .shot { aspect-ratio: auto; height: 168px; }
  /* The wide tile has short copy: let its screenshot take the spare height (lands near 16:10). */
  .tile--yeshuvim .shot { height: auto; flex: 1 1 168px; }

  .tile--exp {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 48px;
    row-gap: 12px;
    padding: 28px 32px;
  }
  .tile--exp h2.label:nth-of-type(1) { grid-column: 1; grid-row: 1; }
  .tile--exp .exp-list { grid-column: 1; grid-row: 2; }
  .tile--exp h2.label:nth-of-type(2) { grid-column: 2; grid-row: 1; margin-top: 0; }
  .tile--exp .edu-list { grid-column: 2; grid-row: 2; align-content: start; margin-top: 0; }
  .edu-list li { padding: 10px 0; border-top: 1px solid var(--line); }
  .edu-list { gap: 0; }
  .edu-list li:last-child { border-bottom: 1px solid var(--line); }
}

/* ---------- No JS: drop the JS-only pieces and close the gaps they leave ---------- */
@media (scripting: none) {
  #email-btn, .tile--clock { display: none; }
}
@media (scripting: none) and (min-width: 640px) {
  /* Tablet: no clock beside it, so the contact tile takes the whole row. */
  .grid > .tile--contact { grid-column: 1 / -1; }
}
@media (scripting: none) and (min-width: 1024px) {
  /* Desktop: no clock, so there is no row 2. The hero and the contact tile share row 1,
     and the three buttons stack as one-line rows so none of them grows tall. */
  .grid > .tile--hero { grid-row: 1; }
  .grid > .tile--contact { grid-column: 3 / span 2; grid-row: 1; }
  .contact-row { grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(0, 1fr); }
  .contact-btn {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    max-height: 140px;
  }
}

/* ---------- Motion ---------- */
/* Entrance: pure CSS fade-up with a 40ms stagger. fill-mode both keeps the end
   state (fully visible), so it needs no JS and never leaves a tile hidden. */
.tile {
  animation: tile-in .55s var(--ease) calc(var(--i, 0) * 40ms) both;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.section-label { animation: tile-in .55s var(--ease) calc(var(--i, 0) * 40ms) both; }
@keyframes tile-in { from { opacity: 0; translate: 0 8px; } }
.tile--hero { --i: 0; }
.tile--contact { --i: 1; }
.tile--clock { --i: 2; }
.section-label { --i: 3; }
.tile--yeshuvim { --i: 4; }
.tile--benfit { --i: 5; }
.tile--mor { --i: 6; }
.tile--exp { --i: 7; }

@media (hover: hover) {
  a.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -18px color-mix(in srgb, var(--shadow) 55%, transparent);
  }
  .project:hover .shot img { scale: 1.03; }
  .contact-btn:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--indigo-2) 45%, var(--line));
    box-shadow: 0 10px 22px -16px color-mix(in srgb, var(--shadow) 60%, transparent);
  }
  .contact-btn--cv:hover { border-color: var(--accent); }
  .contact-btn--cv:hover .icon { translate: 0 2px; }
  .contact-btn--linkedin:hover .icon { translate: 0 -2px; }
  .contact-btn--email:hover .icon { translate: 0 -2px; }
}
a.tile:active, .contact-btn:active { transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .tile { opacity: 1; translate: none; }
  a.tile:hover, .contact-btn:hover { transform: none; }
  .project:hover .shot img { scale: none; }
  .contact-btn .icon { translate: none !important; }
}
