/* Apple-design layer (emilkowalski/skills → apple-design).
   Scoped to html.apple: remove that class from <html> to fall back to styles.css alone. */

html.apple {
  /* §15 system font first: ships optical sizing + tracking tables */
  --font-heading: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", monospace;

  /* §4 critically damped spring (damping 1.0) as a CSS easing; settle time emerges from response */
  --spring: linear(0, 0.060, 0.186, 0.329, 0.466, 0.584, 0.682, 0.760, 0.821, 0.868, 0.903, 0.929,
    0.949, 0.963, 0.973, 0.981, 0.986, 0.990, 0.993, 0.995, 0.997, 0.998, 0.998, 0.999, 1);
  --resp-04: 0.6s; /* response 0.4 */
  --resp-03: 0.45s; /* response 0.3 */

  --radius-lg: 18px;
  --radius-md: 12px;
}

html.apple[data-theme="light"] {
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --accent-strong: #0058b0;
  --accent-surface: rgba(0, 113, 227, 0.08);
  --topbar-bg: rgba(245, 245, 247, 0.72);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --card-shadow-open: 0 2px 6px rgba(0, 0, 0, 0.05), 0 16px 40px rgba(0, 0, 0, 0.08);
}

html.apple[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --text: #f5f5f7;
  --muted: #98989d;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #2997ff;
  --accent-strong: #0a84ff;
  --accent-surface: rgba(41, 151, 255, 0.14);
  --topbar-bg: rgba(22, 22, 23, 0.68);
  --card-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
  --card-shadow-open: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 20px 50px rgba(0, 0, 0, 0.6);
}

html.apple body {
  font-size: 1.0625rem; /* 17px, Apple body size */
  line-height: 1.47;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  /* ease dark↔light instead of an abrupt brightness jump (§14) */
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* §16 Simplicity / §14: drop full-viewport moving backgrounds, grain and grid */
html.apple .noise,
html.apple .grid-bg,
html.apple .scroll-bg-parallax {
  display: none;
}

html.apple .container {
  width: min(980px, calc(100vw - 40px));
}

/* ── §12 Materials: translucent chrome, content scrolls under, scroll-edge instead of a divider ── */
html.apple .topbar {
  border-bottom: 0;
  background: var(--topbar-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

html.apple .topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 14px;
  pointer-events: none;
  background: linear-gradient(var(--topbar-bg), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

html.apple.is-scrolled .topbar::after {
  opacity: 1;
}

html.apple .topbar-inner {
  padding: 10px 0;
}

html.apple .logo {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Direct, specific labels; sentence case reads calmer than spaced caps */
html.apple .nav {
  position: relative;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.1);
}

html.apple .nav a {
  position: relative;
  z-index: 1;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: -0.005em;
  color: var(--muted);
  transition: color 0.2s ease;
}

html.apple .nav a::after {
  display: none;
}

html.apple .nav a:hover {
  color: var(--text);
}

html.apple .nav a.active {
  color: var(--text);
}

/* §7 Spatial consistency: one indicator that travels between tabs */
html.apple .nav-indicator {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  height: 0;
  width: 0;
  border-radius: 999px;
  background: var(--bg-elevated);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  transition: transform var(--resp-03) var(--spring), width var(--resp-03) var(--spring),
    height var(--resp-03) var(--spring), opacity 0.2s ease;
  opacity: 0;
}

html.apple[data-theme="dark"] .nav-indicator {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

html.apple .theme-toggle {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  text-transform: none;
  letter-spacing: 0;
  border-radius: 999px;
  border: 0;
  padding: 6px 14px;
  background: rgba(127, 127, 127, 0.12);
  color: var(--text);
}

/* ── §15 Typography: size-specific tracking, inverse leading, weight-led hierarchy ── */
html.apple .hero {
  padding: clamp(56px, 12vh, 120px) 0 56px;
}

html.apple .who-label {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--accent);
  margin-bottom: 8px;
}

html.apple .eyebrow {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  color: var(--muted);
  font-weight: 400;
}

html.apple .hero-name {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-optical-sizing: auto;
}

html.apple .hero-role {
  margin-top: 12px;
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.022em;
  color: var(--muted);
}

html.apple .hero-photo {
  width: min(140px, 24vw);
  height: min(140px, 24vw);
  max-width: 140px;
  max-height: 140px;
  border: 0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

html.apple .hero-trust {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  letter-spacing: 0;
}

html.apple .hero-trust li {
  border: 0;
  background: rgba(127, 127, 127, 0.1);
  padding: 5px 12px;
}

html.apple .hero-copy {
  font-size: clamp(1.125rem, 1.6vw, 1.3125rem);
  line-height: 1.42;
  letter-spacing: -0.016em;
  max-width: 40rem;
}

html.apple .hero-copy strong {
  color: var(--text);
}

html.apple .section {
  border-top: 0;
  padding: clamp(56px, 9vh, 96px) 0 0;
}

html.apple .section-head {
  margin-bottom: 28px;
}

html.apple .section-head span.mono {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

html.apple .section-head h2 {
  font-size: clamp(2rem, 4.6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

html.apple .mono {
  letter-spacing: 0;
}

html.apple .card-meta,
html.apple .skill-cat-label,
html.apple .edu-map-label,
html.apple .tag,
html.apple .pow-meta {
  font-family: var(--font-sans);
  text-transform: none;
  letter-spacing: -0.005em;
  font-size: 0.8125rem;
  font-weight: 600;
}

html.apple .tl-year {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  letter-spacing: 0;
}

html.apple .tl-where {
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--muted);
}

html.apple .card h3,
html.apple .timeline h3 {
  font-size: 1.3125rem;
  line-height: 1.2;
  letter-spacing: -0.022em;
  font-weight: 600;
}

/* ── Surfaces: soft depth instead of hard borders and accent stripes ── */
html.apple .glass {
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--card-shadow);
  backdrop-filter: none;
}

html.apple .timeline {
  gap: 12px;
}

html.apple .timeline article {
  padding: 22px 24px;
}

html.apple .timeline article::before {
  display: none;
}

html.apple #proof .pow-card {
  border-left: 0;
  border-radius: var(--radius-lg);
  padding-left: 22px;
}

/* No hover lifts: feedback belongs on the press (§1) */
html.apple .card:hover,
html.apple .newsletter-card:hover,
html.apple .contact-link:hover,
html.apple .btn-glow:hover,
html.apple .btn-outline:hover {
  transform: none;
}

html.apple .skill-category:hover,
html.apple .card:hover {
  border-color: transparent;
  box-shadow: var(--card-shadow);
}

/* ── §3/§4 Accordion: spring, interruptible (CSS transitions re-target from the live value) ── */
html.apple .timeline article.edu-card {
  transition:
    grid-template-rows var(--resp-04) var(--spring),
    box-shadow var(--resp-04) var(--spring),
    transform 0.1s ease-out;
}

html.apple .timeline article.edu-card.edu-card-is-open {
  border-color: transparent;
  transform: none;
  box-shadow: var(--card-shadow-open);
}

html.apple .edu-card-hit {
  border-radius: var(--radius-md);
  padding-right: 40px;
}

html.apple .edu-card-hit:hover {
  background: transparent;
}

/* §8 hint in the direction of the gesture: chevron becomes a +/× that rotates with the spring */
html.apple .edu-card-chevron {
  width: 22px;
  height: 22px;
  right: 4px;
  border: 0;
  border-radius: 50%;
  background: rgba(127, 127, 127, 0.12);
  transform: translateY(-50%) rotate(0deg);
  transition: transform var(--resp-04) var(--spring), background 0.2s ease;
  opacity: 1;
}

html.apple .edu-card-chevron::before,
html.apple .edu-card-chevron::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 1.75px;
  border-radius: 1px;
  background: var(--text);
  transform: translate(-50%, -50%);
}

html.apple .edu-card-chevron::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

html.apple .timeline article.edu-card.edu-card-is-open .edu-card-chevron {
  transform: translateY(-50%) rotate(135deg);
  background: var(--accent-surface);
}

html.apple .edu-map-inner {
  transition:
    opacity 0.3s ease 0.05s,
    transform var(--resp-04) var(--spring);
}

html.apple .edu-map-frame {
  border: 0;
  border-radius: var(--radius-md);
}

/* ── §1 Response: instant press feedback on pointer-down ── */
html.apple .btn,
html.apple .edu-card,
html.apple .contact-link,
html.apple .newsletter-card,
html.apple .theme-toggle,
html.apple .nav a,
html.apple .skill-tag {
  -webkit-tap-highlight-color: transparent;
}

html.apple .btn:active,
html.apple .theme-toggle:active,
html.apple .contact-link:active,
html.apple .newsletter-card:active {
  transform: scale(0.97);
  transition: transform 100ms ease-out;
}

html.apple .timeline article.edu-card:has(.edu-card-hit:active) {
  transform: scale(0.985);
}

/* Buttons: one filled primary, one tinted secondary (Familiarity) */
html.apple .btn {
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  border: 0;
  transition: transform var(--resp-03) var(--spring), background 0.2s ease, opacity 0.2s ease;
}

html.apple .btn-glow {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

html.apple .btn-glow:hover {
  background: var(--accent-strong);
  box-shadow: none;
}

html.apple .btn-outline {
  background: var(--accent-surface);
  color: var(--accent);
}

html.apple .btn-outline:hover {
  box-shadow: none;
  background: rgba(0, 113, 227, 0.14);
}

html.apple .skill-tag {
  border: 0;
  background: rgba(127, 127, 127, 0.1);
  font-size: 0.875rem;
  padding: 6px 12px;
}

html.apple .skill-tag:hover {
  background: var(--accent-surface);
}

html.apple #skills .skill-tag {
  transition:
    opacity 0.4s ease,
    transform var(--resp-04) var(--spring),
    background 0.2s ease;
  transition-delay: calc(var(--skill-stagger, 0) * 18ms), calc(var(--skill-stagger, 0) * 18ms), 0s;
}

html.apple .contact-link {
  padding: 20px 22px;
}

html.apple .terminal {
  border-radius: var(--radius-md);
}

html.apple .footer {
  border-top: 1px solid var(--line);
  margin-top: 96px;
  font-size: 0.8125rem;
}

/* ── Scroll reveal: shorter travel, spring settle, nothing slow and floaty ── */
html.apple .reveal,
html.apple .reveal-slow {
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform var(--resp-04) var(--spring);
}

html.apple .reveal.is-visible,
html.apple .reveal-slow.is-visible {
  transform: none;
}

/* ── §12 Modal: dim to focus, surface materializes (blur + scale) from its trigger ── */
html.apple .modal {
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(4px);
  transition: background-color 0.3s ease;
}

@starting-style {
  html.apple .modal:not(.hidden) {
    background: rgba(0, 0, 0, 0);
  }
}

html.apple .modal-content {
  border-radius: 22px;
  padding: 32px;
  background: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25), 0 0 0 0.5px rgba(127, 127, 127, 0.2);
  transform-origin: var(--origin-x, 50%) var(--origin-y, 50%);
  transition: transform var(--resp-03) var(--spring), opacity 0.25s ease, filter 0.3s ease;
}

@starting-style {
  html.apple .modal:not(.hidden) .modal-content {
    opacity: 0;
    transform: scale(0.92);
    filter: blur(8px);
  }
}

html.apple .modal-sub,
html.apple .modal .mono {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  letter-spacing: -0.005em;
}

html.apple .modal-content h3 {
  font-size: 1.5rem;
  letter-spacing: -0.025em;
}

html.apple .close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(127, 127, 127, 0.14);
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  right: 16px;
  top: 16px;
}

html.apple .form input {
  border-radius: var(--radius-md);
  border: 0;
  background: rgba(127, 127, 127, 0.1);
  font-size: 1rem; /* ≥16px: iOS will not zoom the page on focus */
}

html.apple .form input:focus {
  box-shadow: 0 0 0 3px var(--accent-surface), 0 0 0 1px var(--accent);
}

/* ── §14 Accessibility signals ── */
@media (prefers-reduced-motion: reduce) {
  html.apple .timeline article.edu-card,
  html.apple .edu-card-chevron,
  html.apple .nav-indicator,
  html.apple .modal-content,
  html.apple .btn {
    transition: opacity 0.2s ease;
  }
  html.apple .btn:active,
  html.apple .timeline article.edu-card:has(.edu-card-hit:active) {
    transform: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  html.apple .topbar,
  html.apple .modal-content {
    background: var(--bg-elevated);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  html.apple .glass {
    box-shadow: 0 0 0 1px var(--text);
  }
}

@media (max-width: 720px) {
  html.apple .nav {
    background: transparent;
    padding: 0;
  }
  html.apple .nav a {
    padding: 4px 10px;
    font-size: 0.8125rem;
  }
  html.apple .hero {
    padding: 28px 0 40px;
    text-align: center;
  }
  html.apple .hero-copy {
    font-size: 1.0625rem;
  }
  html.apple .hero-name {
    font-size: clamp(2.25rem, 10vw, 3rem);
  }
}
