/* ============================================
   DESIGN SYSTEM — JASON HANLON PORTFOLIO
   ============================================ */

/* Fonts loaded via <link> in each HTML file for better performance */

/* --- CSS VARIABLES --- */
:root {
  --bg-primary: #0d0d0d;
  --bg-secondary: #111111;
  --bg-card: #161616;
  --text-primary: #f0ede8;
  --text-muted: #888480;
  --text-faint: #808078;
  --accent: #c9b99a;
  --accent-warm: #e8d5b7;
  --accent-glow: rgba(201, 185, 154, 0.12);
  --border: rgba(240, 237, 232, 0.08);
  --border-hover: rgba(201, 185, 154, 0.3);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', sans-serif;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 64px;
  --space-7: 96px;
  --space-8: 128px;
  --space-9: 192px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.87, 0, 0.13, 1);
  --duration-fast: 200ms;
  --duration-med: 400ms;
  --duration-slow: 700ms;
}

/* --- RESET & BASE --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none;
}

::selection {
  background: var(--accent);
  color: var(--bg-primary);
}

/* --- CUSTOM CURSOR --- */
.cursor {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.1s, width 0.3s var(--ease-out), height 0.3s var(--ease-out), background 0.3s;
  mix-blend-mode: difference;
}

.cursor-ring {
  position: fixed;
  width: 36px;
  height: 36px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: transform 0.15s var(--ease-out), width 0.4s var(--ease-out), height 0.4s var(--ease-out), opacity 0.3s, border-color 0.3s;
  opacity: 0.6;
}

body.cursor-hover .cursor { width: 16px; height: 16px; }
body.cursor-hover .cursor-ring { width: 60px; height: 60px; opacity: 0.3; }

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.display-xl {
  font-size: clamp(4rem, 10vw, 11rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
}

.display-lg {
  font-size: clamp(2.5rem, 6vw, 6rem);
  line-height: 1.0;
  letter-spacing: -0.03em;
}

.display-md {
  font-size: clamp(1.8rem, 3.5vw, 3.5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.label {
  font-family: var(--font-body);
  font-size: 0.75rem; /* raised from 0.6875rem (11px) → 12px for WCAG readability */
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.body-lg {
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.7;
  font-weight: 300;
  color: var(--text-muted);
}

.italic { font-style: italic; }
.accent-text { color: var(--accent); }

/* --- LINKS --- */
a {
  color: inherit;
  text-decoration: none;
}

/* --- UTILITY --- */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.container-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}


/* --- NOISE TEXTURE OVERLAY --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  opacity: 0.022;
  pointer-events: none;
  z-index: 1000;
}

/* ─────────────────────────────────────────────────────────────────
   CURSOR TOGGLE  — body.cursor-default restores the OS cursor
   ───────────────────────────────────────────────────────────────── */
body.cursor-default,
body.cursor-default * {
  cursor: auto !important;
}
body.cursor-default a,
body.cursor-default button,
body.cursor-default [role="button"],
body.cursor-default .work-card,
body.cursor-default .skill-item,
body.cursor-default .contact-link-item {
  cursor: pointer !important;
}
body.cursor-default .cursor,
body.cursor-default .cursor-ring {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ─────────────────────────────────────────────────────────────────
   CURSOR TOGGLE PILL
   Idle  → collapses to a small glowing dot (just the thumb)
   Hover → expands smoothly to full pill with label
   ───────────────────────────────────────────────────────────────── */

/* Outer pill -------------------------------------------------------- */
.cursor-toggle-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9980;
  display: flex;
  align-items: center;
  gap: 0;                       /* gap animated via .ct-expandable width */
  padding: 9px 10px;            /* symmetrical when collapsed */
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: none;
  /* Start invisible; JS adds .visible after load */
  opacity: 0;
  pointer-events: none;
  transition:
    opacity        0.6s var(--ease-out),
    border-color   0.4s var(--ease-out),
    background     0.4s var(--ease-out),
    padding        0.55s var(--ease-out),
    box-shadow     0.4s var(--ease-out);
  user-select: none;
  -webkit-user-select: none;
  /* Idle glow — a faint pulse so users notice it */
  animation: ctIdlePulse 3.5s ease-in-out infinite;
}

/* Idle glow keyframe */
@keyframes ctIdlePulse {
  0%,  60%, 100% { box-shadow: 0 0 0 0   rgba(201,185,154,0);    }
  30%            { box-shadow: 0 0 10px 2px rgba(201,185,154,0.12); }
}

/* Pause the pulse while hovered / focused — it's already expanded */
.cursor-toggle-btn:hover,
.cursor-toggle-btn:focus-visible {
  animation: none;
}

.cursor-toggle-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Expanded state (hover OR keyboard focus) */
.cursor-toggle-btn:hover,
.cursor-toggle-btn:focus-visible {
  border-color: var(--border-hover);
  background: rgba(201, 185, 154, 0.05);
  padding: 9px 16px 9px 12px;  /* restore asymmetric padding with label */
}

body.cursor-default .cursor-toggle-btn {
  cursor: pointer !important;
}

/* Track ------------------------------------------------------------ */
.ct-track {
  position: relative;
  width: 30px;
  height: 17px;
  border-radius: 9px;
  background: rgba(240, 237, 232, 0.08);
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: background 0.3s, border-color 0.3s;
}

/* Thumb ------------------------------------------------------------ */
.ct-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: transform 0.35s var(--ease-out), background 0.3s;
}

/* ON state */
.cursor-toggle-btn[aria-pressed="true"] .ct-track {
  background: rgba(201, 185, 154, 0.15);
  border-color: var(--accent);
}
.cursor-toggle-btn[aria-pressed="true"] .ct-thumb {
  transform: translateX(13px);
  background: var(--accent);
}

/* Expandable wrapper — holds the gap + label ----------------------- */
.ct-expandable {
  display: flex;
  align-items: center;
  gap: 10px;
  /* Collapsed: zero width, invisible */
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-width 0.55s var(--ease-out),
    opacity   0.35s var(--ease-out),
    margin-left 0.55s var(--ease-out);
  margin-left: 0;
}

/* Expanded: show full label */
.cursor-toggle-btn:hover   .ct-expandable,
.cursor-toggle-btn:focus-visible .ct-expandable {
  max-width: 160px;   /* wider than any real label */
  opacity: 1;
  margin-left: 10px;  /* becomes the gap */
}

/* Label ------------------------------------------------------------ */
.ct-label {
  font-family: var(--font-body);
  font-size: 0.75rem; /* raised from 0.6rem (9.6px) → 12px for WCAG readability */
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
  transition: color 0.3s;
}
.cursor-toggle-btn[aria-pressed="true"] .ct-label {
  color: var(--accent);
}

/* Hide on touch / mobile / tablet — any device without a precision pointer */
@media (hover: none), (pointer: coarse), (max-width: 768px) {
  .cursor-toggle-btn { display: none !important; }
}

/* ─────────────────────────────────────────────────────────────────
   SKIP NAVIGATION LINK — WCAG 2.4.1 (Level A)
   Visually hidden until focused by keyboard; appears at top of page
   ───────────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  padding: 10px 20px;
  background: var(--accent);
  color: var(--bg-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: 0 0 8px 8px;
  z-index: 10001;
  text-decoration: none;
  transition: top 0.2s var(--ease-out);
  white-space: nowrap;
}
.skip-link:focus {
  top: 0;
  outline: 2px solid var(--bg-primary);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────────
   SCREEN-READER ONLY UTILITY — visually hidden, accessible to AT
   ───────────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─────────────────────────────────────────────────────────────────
   GLOBAL FOCUS STYLES — WCAG 2.4.7 (Level AA)
   Baseline catches any element not explicitly styled below.
   All interactive elements get a visible accent-coloured outline.
   ───────────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Nav links */
.nav-links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
  border-radius: 2px;
}

/* Work cards — use a rounded outline matching the card corners */
.work-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Contact link rows */
.contact-link-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

