/* ============================================================
   TYLER WILLIAMS — PORTFOLIO
   Design tokens live as CSS custom properties on :root so the
   in-browser editor can rewrite the palette live.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Libre+Franklin:wght@500;700;800;900&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --navy: #0B1F3A;
  --navy-deep: #060F1A;
  --crimson: #C8102E;
  --cream: #F6F3EC;
  --ink: #16202B;
  --steel: #5B7FA6;
  --brass: #B8935A;
  --white: #FFFFFF;

  --font-display: 'Libre Franklin', system-ui, sans-serif;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --max-w: 1180px;
  --edge: clamp(20px, 5vw, 64px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: var(--edge);
  padding-right: var(--edge);
}

:focus-visible {
  outline: 3px solid var(--crimson);
  outline-offset: 3px;
}

/* ---------- Nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 31, 58, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(184, 147, 90, 0.35);
}
.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--white);
  text-decoration: none;
  font-size: 1.05rem;
}
.brand span { color: var(--crimson); }
.nav-links {
  display: flex;
  gap: clamp(14px, 2vw, 28px);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  text-decoration: none;
  color: rgba(246, 243, 236, 0.82);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--white); }
.nav-toggle { display: none; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: var(--cream);
  position: relative;
  overflow: hidden;
}
.hero .wrap {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: clamp(32px, 5vw, 64px);
  padding-top: clamp(56px, 9vw, 96px);
  padding-bottom: clamp(56px, 9vw, 96px);
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--brass);
  text-transform: uppercase;
  margin: 0 0 18px;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.hero .tagline {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--steel);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  margin: 0 0 22px;
}
.hero .summary {
  font-size: 1.08rem;
  color: rgba(246, 243, 236, 0.86);
  max-width: 46ch;
  margin: 0 0 30px;
}
.hero-ctas { display: flex; flex-wrap: wrap; gap: 14px; }
.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-decoration: none;
  padding: 13px 26px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--crimson); color: var(--white); }
.btn-primary:hover { background: #a80d26; }
.btn-ghost { background: transparent; color: var(--cream); border-color: rgba(246,243,236,0.4); }
.btn-ghost:hover { border-color: var(--brass); color: var(--brass); }

.hero-portrait {
  position: relative;
  justify-self: center;
}
.hero-portrait .frame {
  position: relative;
  width: min(340px, 78vw);
  aspect-ratio: 4 / 5;
  transform: rotate(-1.4deg);
}
.hero-portrait .frame::before {
  content: "";
  position: absolute;
  inset: -14px -14px auto auto;
  width: 100%;
  height: 100%;
  border: 2px solid var(--brass);
  z-index: 0;
}
.hero-portrait img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  box-shadow: 0 30px 60px -18px rgba(0,0,0,0.55);
}

/* ---------- Scoreboard stat strip ---------- */
.scoreboard {
  background: var(--navy-deep);
  border-top: 1px solid rgba(184,147,90,0.35);
  border-bottom: 1px solid rgba(184,147,90,0.35);
}
.scoreboard .wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0;
}
.stat {
  padding: 22px 18px;
  text-align: center;
  border-left: 1px solid rgba(184,147,90,0.2);
  position: relative;
}
.stat:first-child { border-left: none; }
.stat-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  color: var(--brass);
  letter-spacing: 0.02em;
}
.stat-label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(246,243,236,0.65);
  margin-top: 6px;
}

/* ---------- Sections ---------- */
section.block { padding: clamp(56px, 8vw, 92px) 0; }
.block-head { margin-bottom: clamp(30px, 5vw, 46px); max-width: 62ch; }
.eyebrow-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--crimson);
  margin: 0 0 10px;
}
.block-head h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
  color: var(--navy);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.block-head p { margin: 0; color: #4a5563; }

/* ---------- Experience timeline ---------- */
.timeline { position: relative; }
.timeline-item {
  position: relative;
  padding: 0 0 0 32px;
  border-left: 2px solid rgba(11,31,58,0.12);
  padding-bottom: 34px;
}
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cream);
  border: 3px solid var(--crimson);
}
.timeline-item.is-current::before { background: var(--crimson); }
.xp-card {
  background: var(--white);
  border: 1px solid rgba(11,31,58,0.08);
  border-radius: 6px;
  padding: 22px 24px;
  box-shadow: 0 1px 2px rgba(11,31,58,0.04);
}
.xp-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 4px;
}
.xp-org {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--navy);
  font-size: 1.08rem;
}
.xp-dates {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--steel);
  white-space: nowrap;
}
.xp-role {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: normal;
  color: var(--crimson);
  font-size: 0.88rem;
  margin-bottom: 4px;
}
.xp-loc { font-size: 0.85rem; color: #6b7684; margin-bottom: 10px; font-family: var(--font-display); }
.xp-card ul { margin: 0; padding-left: 20px; }
.xp-card li { margin-bottom: 5px; }
.current-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(200,16,46,0.1);
  color: var(--crimson);
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ---------- Leadership grid ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.lead-card {
  background: var(--navy);
  color: var(--cream);
  border-radius: 6px;
  padding: 24px 26px;
  position: relative;
  overflow: hidden;
}
.lead-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--brass);
}
.lead-org {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.02rem;
  margin-bottom: 4px;
}
.lead-role {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--brass);
  margin-bottom: 2px;
}
.lead-dates {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: rgba(246,243,236,0.55);
  margin-bottom: 12px;
  display: block;
}
.lead-card ul { margin: 0; padding-left: 18px; font-size: 0.94rem; color: rgba(246,243,236,0.88); }
.lead-card li { margin-bottom: 4px; }

.activity-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.activity-chip {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid rgba(11,31,58,0.18);
  padding: 7px 14px;
  border-radius: 20px;
  color: var(--navy);
}

/* ---------- Education ---------- */
.edu-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  border-top: 1px solid rgba(11,31,58,0.1);
  flex-wrap: wrap;
}
.edu-row:last-child { border-bottom: 1px solid rgba(11,31,58,0.1); }
.edu-degree { font-family: var(--font-display); font-weight: 800; color: var(--navy); }
.edu-org { color: #4a5563; }
.edu-detail { color: var(--crimson); font-family: var(--font-mono); font-size: 0.82rem; margin-top: 2px; }
.edu-meta { text-align: right; font-family: var(--font-mono); font-size: 0.82rem; color: var(--steel); white-space: nowrap; }

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 26px;
}
.skill-group-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--crimson);
  margin-bottom: 12px;
}
.skill-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-pill {
  background: var(--white);
  border: 1px solid rgba(11,31,58,0.14);
  font-size: 0.85rem;
  font-family: var(--font-display);
  padding: 7px 13px;
  border-radius: 4px;
  color: var(--ink);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy-deep);
  color: rgba(246,243,236,0.55);
}
.footer-top {
  padding: 44px 0 30px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(184,147,90,0.2);
}
.footer-top h3 {
  font-family: var(--font-display);
  color: var(--cream);
  font-size: 1.3rem;
  margin: 0 0 8px;
}
.footer-contact { font-family: var(--font-mono); font-size: 0.86rem; line-height: 1.9; }
.footer-contact a { text-decoration: none; color: rgba(246,243,236,0.75); }
.footer-contact a:hover { color: var(--brass); }

/* This bottom bar is the secret trigger: three quick clicks opens
   the editor login. It looks like an ordinary copyright line. */
.footer-bottom {
  padding: 18px 0;
  font-size: 0.76rem;
  font-family: var(--font-mono);
  text-align: center;
  user-select: none;
  cursor: default;
}

/* ============================================================
   EDIT MODE
   ============================================================ */
.editable-hit {
  outline: 1px dashed transparent;
  transition: outline-color .15s ease, background .15s ease;
  border-radius: 3px;
}
body.edit-mode .editable-hit:hover {
  outline-color: var(--crimson);
  background: rgba(200,16,46,0.05);
  cursor: pointer;
}
body.edit-mode .card-controls { display: flex; }
.card-controls {
  display: none;
  gap: 6px;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
}
.card-controls button {
  width: 26px; height: 26px;
  border: none;
  border-radius: 4px;
  background: rgba(6,15,26,0.85);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.card-controls button:hover { background: var(--crimson); }
.timeline-item, .lead-card { position: relative; }
.lead-card .card-controls button,
.timeline-item .card-controls button { background: rgba(255,255,255,0.15); }
body.edit-mode .xp-card, body.edit-mode .lead-card { cursor: grab; }
.dragging { opacity: 0.4; }
.drag-over { outline: 2px dashed var(--brass); }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(6,15,26,0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: 8px;
  max-width: 480px;
  width: 100%;
  padding: 32px;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.5);
  max-height: 88vh;
  overflow-y: auto;
}
.modal h3 {
  font-family: var(--font-display);
  color: var(--navy);
  margin: 0 0 6px;
  font-size: 1.3rem;
}
.modal p.hint { color: #6b7684; font-size: 0.88rem; margin: 0 0 20px; }
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="date"],
.field input[type="email"],
.field input[type="color"],
.field input[type="url"],
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(11,31,58,0.2);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--cream);
}
.field textarea { resize: vertical; min-height: 70px; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end; }
.error-text { color: var(--crimson); font-size: 0.85rem; margin-top: 10px; display: none; }
.error-text.show { display: block; }

/* ---------- Editor toolbar ---------- */
.editor-toolbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--navy-deep);
  border-top: 2px solid var(--crimson);
  color: var(--cream);
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px clamp(14px, 3vw, 30px);
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-display);
}
body.edit-mode .editor-toolbar { display: flex; }
body.edit-mode { padding-bottom: 62px; }
.editor-toolbar .label {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 700;
}
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tb-btn {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid rgba(246,243,236,0.25);
  background: transparent;
  color: var(--cream);
  cursor: pointer;
}
.tb-btn:hover { border-color: var(--brass); color: var(--brass); }
.tb-btn.primary { background: var(--crimson); border-color: var(--crimson); color: #fff; }
.tb-btn.primary:hover { background: #a80d26; }

/* ---------- Editor side panel ---------- */
.editor-panel {
  position: fixed;
  top: 0; right: 0;
  width: min(400px, 100vw);
  height: 100vh;
  background: var(--white);
  z-index: 160;
  box-shadow: -12px 0 40px rgba(0,0,0,0.25);
  transform: translateX(100%);
  transition: transform .25s ease;
  overflow-y: auto;
  padding: 26px 24px 100px;
}
.editor-panel.open { transform: translateX(0); }
.editor-panel h3 {
  font-family: var(--font-display);
  color: var(--navy);
  margin: 0 0 4px;
}
.editor-panel .close-panel {
  position: absolute;
  top: 20px; right: 20px;
  background: none; border: none;
  font-size: 22px; cursor: pointer;
  color: var(--navy);
}
.theme-swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.swatch-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.1);
  cursor: pointer;
}
.small-note { font-size: 0.78rem; color: #6b7684; margin: 4px 0 18px; line-height: 1.5; }

.toast {
  position: fixed;
  bottom: 78px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: var(--white);
  padding: 12px 22px;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-portrait { order: -1; }
  .nav-links { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
