/* ===========================================================================
   Saul O'Grady — clean, light, minimalist portfolio.
   Build: v15 main-level-route-transition
   Original identity preserved: white background, black text, Outfit type,
   spinning logo, red accent (#e7131a). Polish, not gimmicks.
   =========================================================================== */

:root {
  --bg:        #ffffff;
  --bg-soft:   #fafafa;
  --ink:       #111111;
  --ink-soft:  #555555;
  --ink-dim:   #888888;
  --line:      #e6e6e6;
  --accent:    #e7131a;
  --accent-ink:#c10f15;
  --radius:    6px;
  --maxw:      820px;
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

/* ---------- Root overflow lock (v15) ----------
   Lock the horizontal axis on BOTH html and body. On mobile the scroll
   container is <html>, so locking only <body> let the page drift. */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
@supports (overflow: clip) {
  html, body { overflow-x: clip; }
}

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

body {
  position: relative;
  font-family: 'Outfit', sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 18px;
  font-weight: 300;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Belt-and-braces: no primary structural element may exceed the viewport. */
.content-wrapper,
header,
.header-inner,
main,
section,
.container,
.contact-form,
.contact-form form,
.iframe-container,
.track-list,
.social-links,
nav,
nav ul {
  max-width: 100%;
  min-width: 0;
}

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

a { color: var(--accent-ink); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--accent); }

h2 {
  font-size: 2rem;
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  font-weight: 600;
  margin: 0 0 .5rem;
  letter-spacing: -0.01em;
}
h3 { font-weight: 500; margin: 0 0 .75rem; }
p  { margin: 0 0 1rem; color: var(--ink-soft); }
h2:focus, section:focus { outline: none; }

/* ---------- Skip link: hidden until focused ---------- */
.skip-link {
  position: absolute;
  left: 0; top: 0;
  transform: translateY(-120%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
  z-index: 1000;
  font-weight: 500;
  transition: transform .2s var(--ease);
}
.skip-link:focus { transform: translateY(0); color: #fff; }

/* ---------- Visually-hidden honeypot ---------- */
.hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Focus states ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Layout ---------- */
.content-wrapper { width: 100%; }
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 22px;
  text-align: center;
}

/* ---------- Header / nav ----------
   v15: pure block + inline-block. NO flexbox, NO gap, NO sticky, NO
   backdrop-filter, NO @supports anywhere in the header/nav. Old iOS Safari can
   falsely pass @supports(display:flex) yet render flex centering/wrap badly,
   which clipped the nav to fragments ("ne", "Mus"). Block layout is bulletproof. */
header {
  position: relative;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 18px 10px 16px;
  text-align: center;
}
.logo-container {
  display: block;
  width: 118px;
  height: 118px;
  margin: 0 auto 14px;
  text-align: center;
}
.logo {
  display: block;
  width: 126px;          /* plain fallback for old iOS Safari */
  height: 126px;
  object-fit: contain;
  /* v15: CSS-ONLY vertical-axis (rotateY) spin — the original working model.
     No JavaScript involvement, so it cannot be left static by a JS spinner that
     fails to paint. Prefixed declarations for mobile WebKit / iOS Safari. */
  transform-origin: 50% 50%;
  -webkit-transform-origin: 50% 50%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
  animation: sog-logo-original-axis-spin-v15 5s linear infinite;
  -webkit-animation: sog-logo-original-axis-spin-v15 5s linear infinite;
}
.logo-container:hover .logo {
  animation-duration: 2.5s;
  -webkit-animation-duration: 2.5s;
}
/* v15: slightly larger, fluid logo where clamp() is supported (modern browsers).
   Old iOS Safari keeps the 118px plain fallback above. */
@supports (width: clamp(1px, 2vw, 3px)) {
  .logo { width: clamp(126px, 17vw, 140px); height: clamp(126px, 17vw, 140px); }
}
@keyframes sog-logo-original-axis-spin-v15 {
  from { transform: rotateY(0deg); -webkit-transform: rotateY(0deg); }
  to   { transform: rotateY(360deg); -webkit-transform: rotateY(360deg); }
}
@-webkit-keyframes sog-logo-original-axis-spin-v15 {
  from { -webkit-transform: rotateY(0deg); transform: rotateY(0deg); }
  to   { -webkit-transform: rotateY(360deg); transform: rotateY(360deg); }
}

/* v15: nav is pure block / inline-block. No flex anywhere — guaranteed correct
   on old iOS Safari. Spacing comes from li margins only. */
nav { display: block; width: 100%; text-align: center; }
nav ul {
  display: block;
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: center;
}
nav li { display: inline-block; margin: 0 7px 8px; vertical-align: top; }
.nav-link {
  display: inline-block;
  white-space: nowrap;
  padding: 6px 4px;
  color: var(--ink-soft);
  font-weight: 500;
  letter-spacing: .02em;
  position: relative;
  transition: color .2s var(--ease);
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 4px; right: 4px; bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s var(--ease);
}
.nav-link:hover { color: var(--ink); }
.nav-link.active-link { color: var(--ink); }
.nav-link.active-link::after { transform: scaleX(1); }

/* ---------- Sections / routing ----------
   v15: sections are visible by DEFAULT (fail-open). The router adds
   `.routing-ready` to <html> ONLY after it has successfully activated a valid
   section. Inactive sections are hidden only under .routing-ready, so if JS
   fails or never runs, every section stays visible and the body is never blank. */
.content { display: block; }

/* v15: route transition is animated on #main (which NEVER changes display), not
   on the section itself. Animating an element while its `display` toggles is
   unreliable on mobile Safari (the transition gets skipped). #main fades/moves
   out, the active section is swapped via display while #main is hidden, then
   #main fades back in. Vertical-only, no native smooth-scroll dependency. */
.routing-ready .content { display: none; }
.routing-ready .content.active { display: block; }

.routing-ready #main {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 220ms ease, transform 220ms ease;
  will-change: opacity, transform;
}
.routing-ready #main.route-leaving,
.routing-ready #main.route-entering {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

/* ---------- Home ---------- */
#home .container { max-width: 680px; padding-top: 48px; padding-bottom: 56px; }
.lede {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 500;
  color: var(--ink);
  font-size: .9rem;
  font-size: clamp(.85rem, 2.4vw, 1rem);
  margin-bottom: 1.25rem;
}
.cta-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.75rem;
}

/* ---------- Buttons ---------- */
.btn {
  /* v15: compact, proportionate to type — no oversized pill buttons. */
  display: inline-block;
  padding: 0.55rem 1.05rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.2;
  letter-spacing: .02em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .18s var(--ease), background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); color: #fff; transform: translateY(-2px); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: #fff; transform: translateY(-2px); }

/* ---------- Compact track list / custom player (v15) ----------
   A slim track list, not big cards. Native <audio> controls are hidden; play is
   driven by a small custom button. Each row stays ~52px tall before progress. */
.track-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 480px;
  margin: 22px auto 4px;
}
.track {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  transition: border-color .2s var(--ease);
}
.track:hover { border-color: var(--ink); }
.track.playing { border-color: var(--accent); }

.track-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

/* Small circular play/pause control */
.track-icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.track-toggle:hover .track-icon { background: var(--accent-ink); transform: scale(1.06); }
.track-icon svg { width: 13px; height: 13px; fill: #fff; display: block; }
.track-icon .ic-pause { display: none; }
.track.playing .track-icon .ic-play { display: none; }
.track.playing .track-icon .ic-pause { display: block; }

.track-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.track-title {
  font-weight: 500;
  font-size: .95rem;
  color: var(--ink);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-sub { color: var(--ink-dim); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }

/* Native audio element is hidden; the custom button + slim bar drive it. */
.track-audio { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Slim custom progress bar (shown only while a track is active) */
.track-player { padding: 0 12px 10px; }
.track-progress {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  cursor: pointer;
}
.track-progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  border-radius: 2px;
  background: var(--accent);
}

.audio-status { font-size: .74rem; color: var(--ink-soft); margin: 6px 0 0; font-style: italic; }
.audio-status.error { color: var(--accent-ink); font-style: normal; }

.now-playing {
  min-height: 1.2em;
  color: var(--accent-ink);
  font-size: .8rem;
  letter-spacing: .03em;
  margin: 12px 0 0;
}

/* ---------- Remix iframe ---------- */
.iframe-container { display: flex; justify-content: center; margin-top: 6px; }

/* ---------- Contact ---------- */
#form-messages { min-height: 1.3em; margin-bottom: 6px; font-weight: 500; }
#form-messages.success { color: var(--accent-ink); }
#form-messages.error { color: #c0392b; }

.contact-form {
  max-width: 480px;
  margin: 0 auto 8px;
  text-align: left;
}
.contact-form label {
  display: block;
  margin: 14px 0 6px;
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  /* v15: inset ring instead of an outer one, so the focus highlight can never
     extend past the field edge and nudge horizontal scroll on mobile. */
  box-shadow: inset 0 0 0 2px rgba(231, 19, 26, .25);
}
.contact-form textarea { resize: vertical; min-height: 110px; }
.contact-form .btn { margin-top: 20px; }

.contact-email { color: var(--ink-soft); margin-top: 26px; }

/* ---------- Social ---------- */
.social-media { margin-top: 8px; }
.social-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 28px;
  justify-content: center;
  flex-wrap: wrap;
}
.social-links a {
  display: inline-block;
  padding: 6px 2px;
  color: var(--ink);
  font-weight: 500;
  position: relative;
  transition: color .2s var(--ease);
}
.social-links a::after {
  content: "";
  position: absolute;
  left: 2px; right: 2px; bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s var(--ease);
}
.social-links a:hover { color: var(--accent-ink); }
.social-links a:hover::after { transform: scaleX(1); }

/* ---------- Footer ---------- */
.footer-text {
  text-align: center;
  color: var(--ink-dim);
  font-size: .8rem;
  padding: 24px 20px 36px;
  margin: 0;
}

/* ---------- Reveal animation ----------
   IMPORTANT: only hide reveal elements when JavaScript is available
   (html.js is set by an inline script in <head>). Without JS — or if the
   external script fails to load — content stays fully visible. This guarantees
   the body can never disappear. */
/* v15: reveal animation removed — with single-section routing it risked leaving
   a freshly-activated section blank if IntersectionObserver didn't re-fire.
   The section fade-in (sectionIn) provides motion on switch instead. */

/* ---------- Responsive ---------- */
/* v15: centred, brand-led desktop header (logo above nav), matching the
   stronger mobile composition instead of splitting logo left / nav right. */
@media (min-width: 720px) {
  .header-inner { display: block; padding: 24px 22px 18px; text-align: center; }
  .logo-container { display: block; width: 132px; height: 132px; margin: 0 auto 16px; }
  .logo { width: 132px; height: 132px; }
  nav li { margin: 0 12px 8px; }
}
@media (max-width: 420px) {
  body { font-size: 17px; }
  .track-list { max-width: 100%; }
}

/* ---------- Reduced motion ----------
   This is the ONLY place the logo animation is disabled. No width-based media
   query touches it, so ordinary mobile users (reduced-motion off) see it spin. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* v15: deliberately scoped so it does NOT include .logo — the client requires
     the logo to keep spinning on mobile. Only section fades/transitions reduce. */
  .routing-ready #main,
  .routing-ready #main.route-leaving,
  .routing-ready #main.route-entering {
    transition: none !important; opacity: 1 !important; transform: none !important;
  }
  .reveal, .reveal.reveal { opacity: 1 !important; transform: none !important;
    transition-duration: .001ms !important; }
  .nav-link::after, .social-links a::after, .btn { transition-duration: .001ms !important; }
}

/* ===========================================================================
   v15 polish additions
   =========================================================================== */

/* v15: hero background watermark removed — home stays plain white. */

/* Small red mark beneath section headings — a deliberate, restrained accent.
   Centred to match the centred headings. Excluded from the hero name. */
#music h2, #contact h2 { position: relative; padding-bottom: 12px; }
#music h2::after, #contact h2::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 26px;
  height: 3px;
  transform: translateX(-50%);
  background: var(--accent);
  border-radius: 2px;
}

/* Slightly stronger, more editorial hero typography on wider screens. */
@media (min-width: 900px) {
  #home h2 { font-size: 2.6rem; font-size: clamp(2.4rem, 4vw, 3.2rem); }
  #home .container { max-width: 640px; }
  #home .lede { font-size: 1.02rem; }
}
