/* =====================================================
   philham.com — stylesheet
   ===================================================== */

:root {
  --bg:        #2e6b5e;
  --bg-deep:   #234f46;
  --bg-card:   #275a4f;
  --rule:      #437a6e;
  --text:      #f1ebd8;
  --text-dim:  #c8c0a8;
  --text-low:  #8fa39b;
  --accent:    #f0b54a;
  --accent-hi: #ffd277;
  --shadow:    0 12px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.12);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Subtle film-grain overlay */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

::selection { background: var(--accent); color: #1b3d36; }

a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed var(--rule);
  transition: color 140ms ease, border-color 140ms ease;
}
a:hover { color: var(--accent-hi); border-bottom-color: var(--accent); }

/* ------------ Page layout ------------ */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 40px 56px;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--text-dim);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 36px;
}
.topbar .home {
  color: var(--text-dim);
  border: none;
  transition: none;
}
.topbar .home:hover { color: var(--accent-hi); }
.topbar .imdb {
  color: var(--text);
  border: 1px solid var(--rule);
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 12px;
  letter-spacing: 0.04em;
  transition: all 140ms ease;
}
.topbar .imdb:hover {
  background: var(--accent);
  color: #1b3d36;
  border-color: var(--accent);
}

/* ------------ Main grid: text | gallery, music below text ------------ */
.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  grid-template-areas:
    "text    gallery"
    "music   gallery";
  gap: 40px 48px;
  align-items: start;
}
.hero    { grid-area: text; }
.gallery { grid-area: gallery; }
.music   { grid-area: music; }

/* Hero text — heading is a link back to home */
.name-link {
  color: var(--text);
  border-bottom: none;
  text-decoration: none;
  display: inline-block;
  transition: none;
}
.name-link:hover { color: var(--accent-hi); }
.name {
  font-size: clamp(38px, 4.6vw, 54px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.02;
  margin: 0 0 4px;
}
.role {
  font-size: 17px;
  color: var(--text-dim);
  font-weight: 400;
  margin: 0 0 26px;
}
.about {
  font-size: 15.5px;
  color: var(--text);
  max-width: 50ch;
  margin: 0 0 14px;
}
.about a {
  color: var(--accent);
  border-bottom: none;
  text-decoration: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.about a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  background: var(--accent);
  vertical-align: text-bottom;
  margin-left: 4px;
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ------------ Section dividers ------------
   Persistent left-aligned label with short stub line before
   and long line after, in all viewports. */
.divider {
  color: var(--text-low);
  font-size: 12px;
  letter-spacing: 0.08em;
  margin: 0 0 22px;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}
.divider::before {
  content: "";
  flex: 0 0 24px;
  height: 1px;
  background: var(--rule);
}
.divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule);
}

/* ------------ TV grid ------------ */
.shows {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.tile {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 3px;
  background: var(--bg-deep);
  cursor: pointer;
  display: block;
  border: none;
  color: var(--text);
}
.tile img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.95);
}
.tile:hover img { filter: saturate(1.02) brightness(0.55); }

/* Hover info — instant, no fade */
.tile .info {
  position: absolute;
  inset: 0;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  background: rgba(15, 38, 33, 0);
  color: var(--text);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  line-height: 1.4;
  opacity: 0;
}
.tile:hover .info {
  opacity: 1;
  background: rgba(15, 38, 33, 0.72);
}
.tile .info .ttl {
  color: var(--accent-hi);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}
.tile .info .role-line {
  color: var(--text);
  font-size: 11.5px;
  font-weight: 400;
  margin: 0;
}

/* ------------ Audio player ------------ */
.player {
  background: var(--bg-deep);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

/* Player header — restored. Just the dot + count, no instruction text. */
.player .head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.player .head svg { color: var(--accent); flex: 0 0 auto; }
.player .head .count { color: var(--text-dim); }

.tracks {
  list-style: none;
  margin: 0; padding: 4px 0;
  /* 8 visible rows: 8 × ~36px row + 8px container padding. */
  max-height: calc(36px * 8 + 8px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.tracks::-webkit-scrollbar { width: 8px; }
.tracks::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 4px; }

/* Rows align their FIRST line: num, track title, and duration share the same
   baseline-y. Album (if present) flows underneath without shifting siblings. */
.track {
  --row-line: 18px;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: start;          /* anchor every cell to the top of the row */
  column-gap: 10px;
  padding: 7px 14px;
  position: relative;
  cursor: pointer;
  color: var(--text-dim);
  transition: background 120ms ease, color 120ms ease;
  border-left: 2px solid transparent;
}
.track:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.track .num {
  font-size: 11px;
  line-height: var(--row-line); /* match title line so they sit on same line */
  color: var(--text-low);
  text-align: left;
  font-variant-numeric: tabular-nums;
}
/* Stacked title (primary) + album (secondary) */
.track .name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.track .t-name {
  color: var(--text);
  font-size: 13px;
  line-height: var(--row-line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track .t-album {
  font-style: normal;
  color: var(--text-low);
  font-size: 10.5px;
  line-height: 1.3;
  margin-top: 1px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track .dur {
  font-size: 11px;
  line-height: var(--row-line); /* sit on same line as num + title */
  color: var(--text-low);
  font-variant-numeric: tabular-nums;
}
.track.active {
  background: rgba(240,181,74,0.08);
  border-left-color: var(--accent);
  color: var(--text);
}
.track.active .t-name { color: var(--accent-hi); }
.track.active .num    { color: var(--accent); }

/* Speaker icon — appears only while actually playing.
   When paused, the active track shows its number again. */
.track .speaker {
  position: absolute;
  left: 14px;
  /* Align vertically to the first line of text (the track title),
     matching where `.num` sits. */
  top: calc(7px + 9px);
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--accent);
  display: none;
}
body:not(.paused) .track.active .num     { visibility: hidden; }
body:not(.paused) .track.active .speaker { display: block; }
.track .speaker .arc {
  transform-origin: 4px 9px;
  animation: spk 1.4s ease-in-out infinite;
}
.track .speaker .arc-2 { animation-delay: 0.2s; }
@keyframes spk {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* Transport — [prev] [play] [next] [scrub] [cur / tot] */
.transport {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--text-dim);
}
.times {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;          /* halved from the old transport gap */
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  font-size: 12px;
  margin-left: 6px;
}
.times .sep { color: var(--text-low); opacity: 0.7; }
.times .time { min-width: 32px; text-align: center; }
.times .time.cur { color: var(--text); text-align: right; }
.times .time.tot { text-align: left; color: var(--text-low); }

.scrub-wrap { position: relative; display: flex; align-items: center; margin: 0 6px; }
.scrub-fill {
  position: absolute;
  left: 0; top: 50%;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  transform: translateY(-50%);
  pointer-events: none;
  width: 0%;
}
.scrub {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  cursor: pointer;
  outline: none;
  width: 100%;
  position: relative;
  z-index: 1;
  background: transparent;
}
.scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  transition: transform 120ms ease;
}
.scrub::-webkit-slider-thumb:hover { transform: scale(1.25); }
.scrub::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}
.scrub-track {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  transform: translateY(-50%);
  pointer-events: none;
}

.tbtn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px;
  transition: all 120ms ease;
  padding: 0;
  font-family: var(--mono);
}
.tbtn:hover { color: var(--accent-hi); background: rgba(255,255,255,0.04); }
.tbtn.play {
  background: var(--accent);
  color: #1b3d36;
  width: 34px; height: 34px;
}
.tbtn.play:hover { background: var(--accent-hi); color: #1b3d36; }
.tbtn svg { width: 14px; height: 14px; }
.tbtn.play svg { width: 13px; height: 13px; }

/* Player keeps its natural height (capped at 8 rows) at all sizes —
   it should not stretch to match the gallery. */

/* ------------ Footer (portrait + contact) ------------ */
.footer-block {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 28px;
  align-items: center;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}
.portrait {
  aspect-ratio: 1;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-deep);
}
.portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.95);
}
.contact-block { display: flex; flex-direction: column; gap: 6px; }
.contact-label {
  color: var(--text-low);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.contact-block a {
  color: var(--text);
  font-size: 14.5px;
  width: max-content;
}
.contact-block a.copied { color: var(--accent-hi); }

/* ------------ Modal video player ------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 22, 19, 0.86);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal.open { display: flex; }
.modal-frame {
  position: relative;
  width: min(1100px, 100%);
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.modal-frame iframe {
  width: 100%; height: 100%;
  border: 0;
  display: block;
}
.modal-frame > #modalFrame {
  position: absolute;
  inset: 0;
}
.modal-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--text);
  width: 34px; height: 34px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 140ms ease;
}
.modal-close:hover {
  background: var(--accent);
  color: #1b3d36;
  border-color: var(--accent);
}
.modal-label {
  position: absolute;
  top: -38px;
  left: 0;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

@media (max-width: 880px) {
  .main {
    grid-template-columns: 1fr;
    grid-template-areas:
      "text"
      "gallery"
      "music";
    gap: 44px;
  }
}
@media (max-width: 760px) {
  .wrap { padding: 22px 22px 44px; }
  .footer-block { grid-template-columns: 90px 1fr; gap: 20px; }
  .modal { padding: 20px; }
  .modal-close { top: -40px; }
}
@media (max-width: 520px) {
  .shows { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
