/* ==========================================================
   Tyler Crump: one-page portfolio
   Colours and type live in :root. Dark by default, with a
   light version for people whose system is set to light mode.
   ========================================================== */

:root {
  --bg: #0B0B0C;
  --surface: #151517;
  --line: #27272A;
  --text: #F4F4F5;
  --text-2: #A1A1AA;       /* 7.7:1 on --bg */
  --text-3: #8B8B94;       /* 5.8:1 on --bg */
  --accent: #F2875A;       /* 7.9:1 on --bg */
  --glow: rgba(242, 135, 90, 0.10);
  --btn-bg: #F4F4F5;
  --btn-text: #0B0B0C;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #FAFAF9;
    --surface: #FFFFFF;
    --line: #E4E4E7;
    --text: #18181B;
    --text-2: #52525B;     /* 7.4:1 on --bg */
    --text-3: #6B6B74;     /* 5.1:1 on --bg */
    --accent: #B54A1F;     /* 5.1:1 on --bg */
    --glow: rgba(181, 74, 31, 0.08);
    --btn-bg: #18181B;
    --btn-text: #FAFAF9;
    color-scheme: light;
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background:
    radial-gradient(60rem 40rem at 85% -10%, var(--glow), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p, h1, h2, ul { margin: 0; }
ul { padding: 0; list-style: none; }

a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--bg); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.icon {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Layout ---------- */
.page {
  min-height: 100vh;
  min-height: 100svh;
  max-width: 760px;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 48px) clamp(20px, 6vw, 48px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(48px, 8vh, 96px);
}

.top, .bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-size: 0.875rem; color: var(--text-2);
}

.mark {
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: 10px;
  font-weight: 600; font-size: 0.8rem; letter-spacing: 0.04em; color: var(--text);
  background: var(--surface);
}

.status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface);
}
.status-dot {
  position: relative; width: 8px; height: 8px; border-radius: 50%; background: #3DD68C;
}
.status-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit;
  animation: ping 2.4s var(--ease) infinite;
}
@keyframes ping { 0% { transform: scale(1); opacity: 0.6; } 80%, 100% { transform: scale(2.6); opacity: 0; } }

.intro { align-self: center; }

/* ---------- Name block ---------- */
.name {
  font-size: clamp(3rem, 11vw, 6.25rem);
  font-weight: 650;
  line-height: 0.95;
  letter-spacing: -0.045em;
}
.role {
  margin-top: 16px;
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--accent);
}
.blurb { margin-top: 16px; max-width: 44ch; font-size: 1.0625rem; color: var(--text-2); }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 0 20px;
  border-radius: 999px; border: 1px solid transparent;
  font: 600 0.95rem/1 var(--font); text-decoration: none; white-space: nowrap;
  transition: transform 0.2s var(--ease), background-color 0.2s, border-color 0.2s, color 0.2s;
}
.btn-primary { background: var(--btn-bg); color: var(--btn-text); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:hover .icon { transform: translateY(2px); }
.btn-ghost { color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--text-3); background: var(--surface); }
.btn-ghost:hover .icon { transform: translate(2px, -2px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn .icon { transition: transform 0.2s var(--ease); }

/* ---------- Contact ---------- */
.contact { margin-top: clamp(48px, 8vh, 72px); }
.label {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 8px;
}
.links { border-top: 1px solid var(--line); }
.row {
  position: relative;
  display: grid; grid-template-columns: 6.5rem 1fr auto; align-items: center; gap: 12px;
  min-height: 60px; border-bottom: 1px solid var(--line);
}
.row-label { font-size: 0.875rem; color: var(--text-3); }
.link {
  font-weight: 500; text-decoration: none; word-break: break-word;
  transition: color 0.2s;
}
/* Make the whole row clickable for links */
.link::after { content: ""; position: absolute; inset: 0; }
.row:has(.link:hover) .link, .row:has(.link:focus-visible) .link { color: var(--accent); }
.row-arrow { color: var(--text-3); transition: transform 0.2s var(--ease), color 0.2s; }
.row:has(.link:hover) .row-arrow { color: var(--accent); transform: translate(2px, -2px); }
.row:has(.link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.row .link:focus-visible { outline: none; }

.copy {
  position: relative; z-index: 1;
  min-height: 32px; padding: 0 12px;
  font: 500 0.8rem/1 var(--font); color: var(--text-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.copy:hover { color: var(--text); border-color: var(--text-3); }
.copy.is-done { color: #3DD68C; }

/* Placeholder: something still to add */
.todo { color: var(--text-3); font-style: italic; }
.todo::before {
  content: "TODO"; font-style: normal;
  margin-right: 8px; padding: 2px 6px; border-radius: 4px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--accent); border: 1px dashed var(--accent);
}

.muted { color: var(--text-3); }

/* ---------- Selected work (home) ---------- */
.work, .process { margin-top: clamp(48px, 8vh, 72px); }
.work-list { border-top: 1px solid var(--line); }
.work-list li { border-bottom: 1px solid var(--line); }
.work-row {
  position: relative;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; align-items: baseline;
  padding: 18px 28px 18px 0; text-decoration: none;
}
.work-row::after {
  content: "→"; position: absolute; right: 2px; top: 18px; color: var(--text-3);
  transition: transform 0.2s var(--ease), color 0.2s;
}
.work-name { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.015em; transition: color 0.2s; }
.work-tags { font-size: 0.8rem; color: var(--text-3); text-align: right; }
.work-desc { grid-column: 1 / -1; color: var(--text-2); font-size: 0.95rem; max-width: 60ch; }
.work-row:hover .work-name, .work-row:focus-visible .work-name { color: var(--accent); }
.work-row:hover::after { color: var(--accent); transform: translateX(3px); }

/* ---------- How I work (home) ---------- */
.process-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 32px; border-top: 1px solid var(--line); padding-top: 20px; }
.process-list dt { font-weight: 600; margin-bottom: 4px; }
.process-list dd { margin: 0; color: var(--text-2); font-size: 0.95rem; }
.process-list a { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: 3px; }
@media (max-width: 600px) { .process-list { grid-template-columns: 1fr; } }

/* ---------- Project pages ---------- */
.page-project { grid-template-rows: auto 1fr auto auto; }
.back { color: var(--text-2); text-decoration: none; font-weight: 500; }
.back:hover { color: var(--text); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 0.85rem; }
.project { max-width: 100%; }
.kicker { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.project-title { margin-top: 10px; font-size: clamp(2.4rem, 8vw, 4.25rem); font-weight: 650; line-height: 1; letter-spacing: -0.04em; }
.project-lede { margin-top: 16px; max-width: 56ch; font-size: 1.1rem; color: var(--text-2); }

.meta {
  margin: 32px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px 24px;
  padding: 20px 0; border-block: 1px solid var(--line);
}
.meta dt { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.meta dd { margin: 4px 0 0; font-size: 0.95rem; }

.media { margin: 32px 0 0; }
.media img, .media video { width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.media figcaption { margin-top: 10px; font-size: 0.85rem; color: var(--text-3); }
.media-logo img { border: 0; background: transparent; max-width: 520px; }
.media-phones { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 20px; justify-content: start; }
.media-phones figcaption { grid-column: 1 / -1; }
.media-todo {
  display: grid; place-content: center; gap: 8px; text-align: center; padding: 20px;
  border: 1px dashed var(--line); border-radius: 14px; background: var(--surface);
}
.media-hint { font-size: 0.85rem; color: var(--text-3); }

.block { margin-top: 44px; scroll-margin-top: 24px; }
.gallery { margin-top: 28px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.gallery figcaption { margin-top: 8px; font-size: 0.85rem; color: var(--text-3); }
@media (max-width: 600px) { .gallery { grid-template-columns: 1fr; } }
.block-title { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 12px; }
.block p { color: var(--text-2); max-width: 64ch; }
.block p + p { margin-top: 12px; }
.ticks li { position: relative; padding: 8px 0 8px 22px; border-bottom: 1px solid var(--line); color: var(--text); }
.ticks li:first-child { border-top: 1px solid var(--line); }
.ticks li::before { content: ""; position: absolute; left: 4px; top: 1.15em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
code { font: 0.85em ui-monospace, "SFMono-Regular", Consolas, monospace; padding: 1px 5px; border-radius: 5px; background: var(--surface); border: 1px solid var(--line); }

.link-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-weight: 500; font-size: 0.9rem;
  transition: border-color 0.2s, background-color 0.2s;
}
a.chip:hover { border-color: var(--text-3); background: var(--surface); }
.chip-todo { border-style: dashed; }

.next { border-top: 1px solid var(--line); padding-top: 24px; }
.next a { display: grid; gap: 4px; text-decoration: none; justify-items: end; }
.next-label { font-size: 0.8rem; color: var(--text-3); }
.next-name { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.02em; transition: color 0.2s; }
.next a:hover .next-name { color: var(--accent); }
.muted-link { color: var(--text-3); text-decoration: none; }
.muted-link:hover { color: var(--text); }

@media (max-width: 480px) {
  .top .btn { flex: none; }
  .meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-row { grid-template-columns: 1fr; padding-right: 24px; }
  .work-tags { text-align: left; grid-row: 3; }
  .media-phones { grid-template-columns: 1fr 1fr; gap: 12px; }
}

/* ---------- Entrance (CSS only, so content shows without JS) ---------- */
.intro > * { animation: rise 0.7s var(--ease) both; }
.intro > :nth-child(2) { animation-delay: 60ms; }
.intro > :nth-child(3) { animation-delay: 120ms; }
.intro > :nth-child(4) { animation-delay: 180ms; }
.intro > :nth-child(5) { animation-delay: 240ms; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
  .row { grid-template-columns: 1fr auto; row-gap: 2px; padding-block: 12px; }
  .row-label { grid-column: 1 / -1; }
  .btn { flex: 1; justify-content: center; }
  .bottom { flex-direction: column; align-items: flex-start; gap: 4px; }
}

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

@media (forced-colors: active) {
  .todo::before, .status, .mark, .btn { border: 1px solid CanvasText; }
}
