/* ============================================================
   Rex — personal site
   Direction: Cobalt Editorial
   ============================================================ */

:root {
  --bg:        #f4f5f8;
  --paper:     #ffffff;
  --ink:       #10131a;
  --muted:     #626b7a;
  --faint:     #8b93a1;
  --line:      #d9dde6;
  --line-soft: #e7eaf0;
  --cobalt:    #1a3ee0;
  --cobalt-ink:#12277a;

  --sans: "Helvetica Neue", Helvetica, "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: "SFMono-Regular", "Cascadia Code", Consolas, ui-monospace, monospace;

  --maxw: 940px;
  --gutter: clamp(20px, 5vw, 48px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0c0e13;
    --paper:     #14171f;
    --ink:       #eef1f6;
    --muted:     #9aa3b2;
    --faint:     #6f7787;
    --line:      #262b36;
    --line-soft: #1e222c;
    --cobalt:    #6d8bff;
    --cobalt-ink:#a9bcff;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--cobalt); color: #fff; }

a { color: inherit; text-decoration: none; }

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

/* ---------- Layout shell ---------- */
.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Masthead / nav ---------- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0 22px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: clamp(34px, 6vw, 64px);
  flex-wrap: wrap;
}

.wordmark {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -.03em;
  color: var(--ink);
}
.wordmark .dot { color: var(--cobalt); }

.nav {
  display: flex;
  gap: clamp(14px, 2.4vw, 26px);
  flex-wrap: wrap;
}
.nav a {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--muted);
  padding-bottom: 2px;
  transition: color .15s ease;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] {
  color: var(--cobalt);
  border-bottom: 2px solid var(--cobalt);
}

/* ---------- Page header ---------- */
.kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--cobalt);
  margin: 0 0 16px;
}

h1.title {
  font-size: clamp(34px, 6.5vw, 62px);
  font-weight: 800;
  line-height: 1.0;
  letter-spacing: -.035em;
  margin: 0 0 22px;
  text-wrap: balance;
}
h1.title .blue { color: var(--cobalt); }

.lede {
  font-size: clamp(18px, 2.4vw, 21px);
  line-height: 1.55;
  color: var(--ink);
  max-width: 60ch;
  margin: 0 0 8px;
}
.lede .soft { color: var(--muted); }

/* ---------- Social icon links ---------- */
.socials { display: flex; gap: 12px; margin-top: clamp(26px, 4vw, 34px); }
.socials a {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  transition: color .16s ease, border-color .16s ease, background .16s ease, transform .16s ease;
}
.socials a:hover {
  color: #fff;
  background: var(--cobalt);
  border-color: var(--cobalt);
  transform: translateY(-2px);
}
.socials a:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 3px;
}
.socials svg { width: 19px; height: 19px; }

/* ---------- Section scaffolding ---------- */
.section { margin-top: clamp(48px, 8vw, 88px); }
main > .section:first-of-type { margin-top: 0; }
main > .section:first-of-type .section-head { border-top: none; padding-top: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 12px;
  margin-bottom: 28px;
  border-top: 2px solid var(--ink);
  padding-top: 14px;
}
.section-head .n {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--cobalt);
  font-variant-numeric: tabular-nums;
}
.section-head h2 {
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0;
}
.section-head .aside {
  margin-left: auto;
  font-size: 13px;
  color: var(--faint);
}

/* ---------- Book grid ---------- */
.books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: clamp(18px, 3vw, 30px);
}
.book { display: flex; flex-direction: column; }
.book .cover {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  line-height: 0;
  background: var(--line-soft);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16,19,26,.06), 0 8px 22px rgba(16,19,26,.10);
  transition: transform .18s ease, box-shadow .18s ease;
}
.book .cover img { width: 100%; height: auto; display: block; }
.book:hover .cover {
  transform: translateY(-4px);
  box-shadow: 0 2px 4px rgba(16,19,26,.08), 0 16px 34px rgba(16,19,26,.18);
}
.book .bt {
  margin: 12px 0 2px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.25;
}
.book .ba { font-size: 13px; color: var(--muted); }
.book .arrow { color: var(--cobalt); opacity: 0; transition: opacity .15s ease; }
.book:hover .arrow { opacity: 1; }

/* ---------- Generic link cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.linkcard {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.linkcard:hover {
  border-color: var(--cobalt);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(26,62,224,.10);
}
/* Non-clickable panel variant (holds its own action links) */
.linkcard.panel:hover { transform: none; border-color: var(--line); box-shadow: none; }

.lc-media {
  aspect-ratio: 16 / 9;
  background: var(--line-soft);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.lc-media img { width: 100%; height: 100%; object-fit: contain; display: block; }

.lc-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 22px;
}

.lc-actions { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 4px; }
.lc-actions a {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 700; color: var(--cobalt);
  border-bottom: 1px solid transparent; padding-bottom: 1px;
}
.lc-actions a:hover { border-color: var(--cobalt); }
.lc-actions svg { width: 15px; height: 15px; }

/* Profile card (square photo + text) */
.profilecard {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 460px;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.profilecard:hover {
  border-color: var(--cobalt);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(26,62,224,.10);
}
.profilecard .pc-photo {
  width: 76px; height: 76px; flex: none;
  border-radius: 12px; object-fit: cover;
  border: 1px solid var(--line);
}
.profilecard .pc-body { display: flex; flex-direction: column; gap: 5px; }

.linkcard .lc-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cobalt);
}
.linkcard .lc-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.linkcard .lc-title .ext { color: var(--faint); font-weight: 500; }
.linkcard:hover .lc-title .ext { color: var(--cobalt); }
.linkcard .lc-desc { font-size: 14.5px; color: var(--muted); line-height: 1.5; }

/* ---------- Song of the week ---------- */
.sotw {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(18px, 3vw, 28px);
  align-items: center;
  padding: clamp(22px, 3.5vw, 32px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.sotw .art {
  width: clamp(104px, 22vw, 148px);
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--line-soft);
  box-shadow: 0 10px 30px rgba(16,19,26,.24);
}
.sotw .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sotw .meta .wk {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--cobalt); margin-bottom: 8px;
}
.sotw .meta .song {
  font-size: clamp(22px, 4vw, 32px); font-weight: 800;
  letter-spacing: -.03em; line-height: 1.02; margin-bottom: 4px;
}
.sotw .meta .artist { font-size: 16px; color: var(--muted); margin-bottom: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
  padding: 11px 18px;
  border-radius: 40px;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
  align-self: flex-start;
}
.btn:hover { transform: translateY(-1px); }
.btn.solid { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.btn.solid:hover { background: var(--cobalt-ink); border-color: var(--cobalt-ink); }
.btn.ghost:hover { background: var(--ink); color: var(--bg); }
.btn svg { width: 16px; height: 16px; }

/* ---------- Now / meta list (about) ---------- */
.factlist { list-style: none; margin: 34px 0 0; padding: 0; max-width: 60ch; }
.factlist li {
  display: flex; gap: 16px; align-items: baseline;
  padding: 13px 0; border-top: 1px solid var(--line-soft);
  font-size: 15.5px;
}
.factlist li .k {
  flex: none; width: 108px; color: var(--faint);
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.factlist li .v { color: var(--ink); }
.factlist li .v a { color: var(--cobalt); border-bottom: 1px solid transparent; }
.factlist li .v a:hover { border-color: var(--cobalt); }

/* ---------- Footer ---------- */
.foot {
  margin-top: clamp(64px, 10vw, 110px);
  padding: 26px 0 46px;
  border-top: 2px solid var(--ink);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--faint);
}
.foot a:hover { color: var(--cobalt); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .masthead { padding-bottom: 16px; }
  .sotw { grid-template-columns: 1fr; text-align: left; }
}
