/* ============================================================
   THEME / DESIGN TOKENS
   Every color and core measurement used on the site is
   defined here ONCE as a CSS custom property (variable).
   Change a value here and it updates everywhere it's used —
   this is the single place to retheme the whole site.
   ============================================================ */
:root {
  --sand: #c9b89a;
  --sea-glass: #5f7d79;
  --driftwood: #6f5a44;
  --espresso: #2b2018;
  --slate: #3f4a4f;
  --foam: #efe9dd;
  --ink: #2e3537;

  --radius: 14px;
  --font-display: "Fraunces", serif;
  --font-body: "Inter", sans-serif;
}

/* ============================================================
   GLOBAL RESET / BASE STYLES
   box-sizing makes padding/border count toward an element's
   width instead of adding to it — prevents layout surprises.
   html/body fill the viewport so the fixed background canvas
   has something to size against.
   ============================================================ */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   BACKGROUND LAYERS
   #bg is the <canvas> animated by script.js — fixed full-screen,
   sent behind everything with z-index: -2. Its opacity is
   turned down here so it doesn't overpower the foreground.
   #bg-veil sits one layer above the canvas (z-index: -1) as a
   flat espresso-brown tint, darkening the whole scene for
   contrast/readability. Tweak the opacity values on either
   layer to make the background lighter or darker.
   ============================================================ */
#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  display: block;
  opacity: 0.85;
}

#bg-veil {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: var(--espresso);
  opacity: 0.25;
  pointer-events: none;
}

/* ============================================================
   PAGE LAYOUT (.stage)
   Centers the photo + button panel as a flex row that wraps
   to a column on narrow screens (flex-wrap handles mobile —
   no separate media query needed). clamp() scales the gap
   and padding smoothly between mobile and desktop sizes.
   ============================================================ */
.stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(2.5rem, 6vw, 6rem);
  padding: clamp(1.5rem, 5vw, 4rem);
  flex-wrap: wrap;
}

/* ============================================================
   PORTRAIT
   The circular profile photo + name/title caption.
   ============================================================ */

/* Wrapper: stacks photo and caption vertically, centered.
   flex: 0 0 auto keeps this column from stretching or
   shrinking when the layout wraps. */
.portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  flex: 0 0 auto;
}

/* The circle frame around the photo.
   - aspect-ratio: 1 keeps it perfectly square at any size
   - border-radius: 50% turns the square into a circle
   - overflow: hidden clips the <img> inside to that circle
   - clamp() makes the circle responsive: never smaller than
     180px, never larger than 320px, scales with viewport width
     in between */
.portrait-frame {
  width: clamp(180px, 24vw, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--foam);
  box-shadow:
    0 12px 40px rgba(63, 74, 79, 0.18),
    0 2px 8px rgba(63, 74, 79, 0.12);
  background: var(--sea-glass);
}

/* object-fit: cover fills the circle without distorting the
   image, regardless of the photo's original aspect ratio —
   this is what lets you drop in any photo and have it crop
   to a circle automatically. */
.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Name + role text under the photo. */
.portrait-caption {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--slate);
  line-height: 1.5;
}

/* The smaller "Web Developer · Coastal NC" line nested
   inside the caption via <span>. */
.portrait-caption span {
  display: inline-block;
  margin-top: 0.15rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--driftwood);
}

/* ============================================================
   BUTTON PANEL (nav.panel)
   The vertical stack of four navigation buttons.
   ============================================================ */

/* Container: stacks buttons vertically with even spacing.
   width: min(360px, 90vw) caps the panel width on desktop
   but lets it shrink on narrow phones. */
.panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  width: min(360px, 90vw);
}

/* Individual button card.
   - Near-opaque background (92%) so it stays readable over
     the animated canvas background
   - backdrop-filter: blur softens whatever shows through the
     remaining 8% transparency
   - transition makes hover/focus state changes smooth */
.panel-btn {
  font-family: var(--font-body);
  text-align: left;
  background: rgba(248, 245, 238, 0.92);
  border: 1px solid rgba(63, 74, 79, 0.12);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(63, 74, 79, 0.08);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

/* Mouse hover: nudge right, go fully opaque, highlight border. */
.panel-btn:hover {
  transform: translateX(4px);
  background: rgba(248, 245, 238, 1);
  border-color: var(--sea-glass);
}

/* Keyboard focus: visible outline for accessibility.
   :focus-visible only shows this for keyboard/tab navigation,
   not mouse clicks, so it doesn't look cluttered. */
.panel-btn:focus-visible {
  outline: 3px solid var(--driftwood);
  outline-offset: 2px;
}

/* The bold title text inside each button, e.g. "About Me". */
.btn-label {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--slate);
}

/* The smaller description line under each button title. */
.btn-sub {
  font-size: 0.85rem;
  color: var(--ink);
  opacity: 0.65;
}

/* ============================================================
   MODAL OVERLAY
   The popup that appears when a panel button is clicked.
   Hidden/shown via the `hidden` attribute, toggled in script.js.
   ============================================================ */

/* Full-screen dark backdrop, centers the modal box.
   z-index: 10 keeps it above everything else on the page. */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(46, 53, 55, 0.45);
  backdrop-filter: blur(3px);
  padding: 1.5rem;
  z-index: 10;
}

/* When the `hidden` attribute is present, don't render at all
   (display: none) — this is toggled by script.js. */
.overlay[hidden] {
  display: none;
}

/* The modal "card" itself.
   max-height + overflow-y: auto let long content (like the
   Workflow list) scroll instead of overflowing the screen. */
.overlay-content {
  position: relative;
  background: var(--foam);
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2.5rem;
  box-shadow: 0 20px 60px rgba(46, 53, 55, 0.3);
}

/* Heading inside the modal (e.g. "About Me", "Workflow"). */
.overlay-content h2 {
  font-family: var(--font-display);
  margin: 0 0 1rem;
  color: var(--slate);
  font-size: 1.8rem;
}

/* Body paragraphs inside the modal. */
.overlay-content p {
  line-height: 1.7;
  color: var(--ink);
}

/* Bullet lists inside the modal (used by the Workflow section). */
.overlay-content ul {
  line-height: 1.8;
  padding-left: 1.2rem;
}

/* Links inside the modal (used by the Contact section). */
.overlay-content a {
  color: var(--slate);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--sea-glass);
}

/* Circular × close button, top-right corner of the modal. */
.overlay-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--sand);
  color: var(--slate);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.overlay-close:hover {
  background: var(--sea-glass);
  color: var(--foam);
}

.overlay-close:focus-visible {
  outline: 3px solid var(--driftwood);
  outline-offset: 2px;
}

/* ============================================================
   PROJECT LIST ITEMS
   Used inside the "Projects" modal — one of these per project.
   ============================================================ */
.project-item {
  margin-bottom: 1.25rem;
}

.project-item h3 {
  font-family: var(--font-display);
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  color: var(--slate);
}

/* ============================================================
   ACCESSIBILITY: REDUCED MOTION
   If the user's OS setting requests less motion, drop the
   button hover animation. (The background animation is also
   disabled in script.js for the same setting.)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .panel-btn {
    transition: none;
  }
}
