/* Shared system for every salcedodiego.com site.
   White page, near-black ink, and one accent: Dykem layout blue, the dye a
   machinist brushes on metal before scribing lines. Schibsted Grotesk for
   headings and text, Plex Mono only for numbers and units. */

/* Self-hosted Latin subsets (SIL Open Font License). One variable file covers every weight. */
@font-face { font-family: "Schibsted Grotesk"; src: url("/shared/fonts/schibsted-grotesk.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/shared/fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;

  --bg: #ffffff;
  --bg-2: #f5f5f3;
  --bg-elev: #ffffff;
  --fill: #ececea;
  --fill-2: #d9d9d5;
  --line: rgba(17, 18, 20, 0.09);
  --line-2: rgba(17, 18, 20, 0.18);
  --ink: #111214;
  --text: #111214;
  --text-2: #5d6066;
  --text-3: #8f9298;
  --accent: #1f4fd1;
  --accent-hover: #163ca6;
  --accent-ink: #ffffff;
  --accent-soft: #eaf0fd;
  --danger: #c8341b;
  --bar: rgba(255, 255, 255, 0.88);
  --shadow: 0 1px 2px rgba(17, 18, 20, 0.05), 0 12px 32px rgba(17, 18, 20, 0.07);
  --shadow-lg: 0 30px 90px rgba(17, 18, 20, 0.22);

  --r-xs: 6px;
  --r-s: 10px;
  --r-m: 14px;
  --r-l: 18px;
  --r-xl: 24px;

  --font: "Schibsted Grotesk", "Segoe UI Variable Text", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: "Schibsted Grotesk", -apple-system, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.36, 0.64, 1);
  --t-fast: 140ms;
  --t: 240ms;
  --t-slow: 420ms;

  --page: 1160px;
  --gutter: clamp(20px, 5vw, 48px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.55 var(--font);
  letter-spacing: -0.008em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent); color: #fff; }

/* Links are ink with a blue underline that fills on hover */
a { -webkit-tap-highlight-color: transparent; color: var(--ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; transition: color var(--t-fast) var(--ease), text-decoration-color var(--t-fast) var(--ease); }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }

.wrap { width: 100%; max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 680px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Type: sentence case, tight, confident */
.t-hero, .t-1, .t-2, .t-3 { font-family: var(--font-display); font-weight: 700; }
.t-hero { font-size: clamp(40px, 5.8vw, 78px); line-height: 1.04; letter-spacing: -0.035em; }
.t-1 { font-size: clamp(34px, 4.6vw, 60px); line-height: 1.04; letter-spacing: -0.032em; }
.t-2 { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.12; letter-spacing: -0.024em; }
.t-3 { font-size: 20px; line-height: 1.25; letter-spacing: -0.015em; }
.t-lead { font-size: clamp(19px, 1.9vw, 23px); line-height: 1.45; letter-spacing: -0.014em; }
.t-small { font-size: 14px; line-height: 1.45; }
.t-tiny { font-size: 12px; line-height: 1.35; }
.label { font-size: 14px; line-height: 1.4; color: var(--text-2); }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.blue { color: var(--accent); }
.tabular { font-variant-numeric: tabular-nums; }

/* Top bar */
.bar {
  position: sticky; top: 0; z-index: 50;
  height: 60px;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t) var(--ease);
}
.bar.scrolled { border-bottom-color: var(--line); }
.bar .wrap { height: 100%; display: flex; align-items: center; gap: 24px; }
.bar-title { font: 600 17px/1 var(--font-display); letter-spacing: -0.02em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.bar-title:hover { color: var(--ink); }
.bar-nav { display: flex; gap: 26px; margin-left: auto; font-size: 15px; }
.bar-nav a { color: var(--text-2); text-decoration: none; white-space: nowrap; }
.bar-nav a:hover { color: var(--ink); }
.bar-back { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink); text-decoration: none; }
.bar-back:hover { color: var(--accent); }
.bar-back svg { width: 8px; height: 13px; }
@media (max-width: 480px) { .bar .wrap { gap: 14px; } .bar-nav { gap: 16px; font-size: 14px; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border-radius: var(--r-s);
  background: var(--ink); color: #fff;
  font: 500 15px/1 var(--font); letter-spacing: -0.005em; text-decoration: none;
  transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn:hover { background: var(--accent); color: #fff; }
.btn:active { transform: scale(0.98); }
.btn.blue { background: var(--accent); }
.btn.blue:hover { background: var(--accent-hover); }
.btn.secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.secondary:hover { background: var(--bg-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }

.link-more { display: inline-flex; align-items: center; font-weight: 500; text-decoration: none; color: var(--accent); }
.link-more::after { content: "\2192"; margin-left: 6px; transition: transform var(--t-fast) var(--ease); }
.link-more:hover::after { transform: translateX(3px); }

.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-2);
  color: var(--text-2);
  font: 500 11px/1 var(--mono);
}

/* Grouped list */
.group-label { padding: 0 4px 10px; font-size: 14px; color: var(--text-2); font-weight: 500; }
.group { background: var(--bg-elev); border-radius: var(--r-m); overflow: hidden; box-shadow: 0 0 0 1px var(--line-2); }
.row {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 56px; padding: 10px 16px;
  color: var(--text); text-align: left; text-decoration: none;
  transition: background-color var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: var(--inset, 16px); border-top: 1px solid var(--line); }
a.row:hover, button.row:hover { background: var(--bg-2); color: var(--text); }
a.row:active, button.row:active { background: var(--fill); }
.row-body { flex: 1; min-width: 0; }
.row-title { font-size: 17px; line-height: 1.3; font-weight: 500; }
.row-sub { font-size: 13px; line-height: 1.4; color: var(--text-2); margin-top: 1px; }
.row-end { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 15px; }
.chev { width: 8px; height: 13px; color: var(--text-3); flex: none; }
a.row:hover .chev { color: var(--accent); }
.glyph { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--bg-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.glyph svg { width: 17px; height: 17px; }

/* Sheet */
dialog.sheet {
  width: min(820px, 100vw - 32px);
  max-height: min(900px, 100dvh - 48px);
  padding: 0; border: 0;
  border-radius: var(--r-xl);
  background: var(--bg-elev); color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0; transform: translateY(14px) scale(0.985);
  transition: opacity var(--t) var(--ease-out), transform var(--t-slow) var(--ease-out),
              overlay var(--t) allow-discrete, display var(--t) allow-discrete;
}
dialog.sheet[open] { opacity: 1; transform: none; }
@starting-style { dialog.sheet[open] { opacity: 0; transform: translateY(14px) scale(0.985); } }
dialog.sheet::backdrop {
  background: rgba(17, 18, 20, 0);
  transition: background-color var(--t) var(--ease), overlay var(--t) allow-discrete, display var(--t) allow-discrete;
}
dialog.sheet[open]::backdrop { background: rgba(17, 18, 20, 0.45); }
@starting-style { dialog.sheet[open]::backdrop { background: rgba(17, 18, 20, 0); } }
.sheet-scroll { max-height: inherit; overflow-y: auto; overscroll-behavior: contain; }
.sheet-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.92); color: var(--ink);
  box-shadow: 0 0 0 1px var(--line-2);
  transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.sheet-close:hover { background: var(--ink); color: #fff; }
.sheet-close:active { transform: scale(0.92); }
.sheet-close svg { width: 12px; height: 12px; }
body:has(dialog[open]) { overflow: hidden; }

@media (max-width: 640px) {
  dialog.sheet {
    width: 100vw; max-width: 100vw;
    max-height: calc(100dvh - 24px);
    margin: auto 0 0;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translateY(100%);
  }
  dialog.sheet[open] { transform: none; }
  @starting-style { dialog.sheet[open] { transform: translateY(100%); } }
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 100;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 14px 12px 18px;
  border-radius: var(--r-m);
  background: var(--ink); color: #fff;
  font-size: 15px;
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  transition: transform var(--t) var(--ease-out), opacity var(--t) var(--ease-out);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { color: #8fb0ff; font-weight: 600; }

/* Image placeholders keep their box so nothing shifts when photos arrive */
.ph { background: var(--bg-2); overflow: hidden; }
.ph img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--t-slow) var(--ease); }
.ph img.in { opacity: 1; }

.footer { padding: 40px 0 56px; font-size: 14px; color: var(--text-2); }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}
