:root {
  color-scheme: light;
  --bg: #fcfcfb;
  --surface: #ffffff;
  --surface-hover: #f3f3f0;
  --text-primary: #141413;
  --text-secondary: #4a4a46;
  --text-muted: #7c7c76;
  --border: rgba(20, 20, 19, 0.08);
  --border-strong: rgba(20, 20, 19, 0.14);
  --accent: #00a876;
  --accent-bar: #00cc91;
  --icon-ring: rgba(20, 20, 19, 0.09);
  --icon-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.04);
  --icon-shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.08), 0 10px 24px rgba(0, 0, 0, 0.07);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e0f;
  --surface: #161618;
  --surface-hover: #1b1b1e;
  --text-primary: #efefec;
  --text-secondary: #a8a8a3;
  --text-muted: #70706b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #10d49a;
  --accent-bar: #00cc91;
  --icon-ring: rgba(255, 255, 255, 0.14);
  --icon-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 16px rgba(0, 0, 0, 0.25);
  --icon-shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.45), 0 14px 30px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.7;
  transition: background-color 0.2s ease, color 0.2s ease;
}

::selection {
  background-color: rgba(0, 204, 145, 0.2);
  color: inherit;
}

.top-accent {
  height: 2px;
  width: 100%;
  background: var(--accent-bar);
}

.page {
  max-width: 650px;
  margin: 0 auto;
  padding: clamp(44px, 8.5vh, 84px) 24px 72px;
  animation: fade-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: var(--text-primary);
}

.site-title a {
  color: inherit;
  text-decoration: none;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text-primary);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  color: var(--text-primary);
  background-color: var(--surface-hover);
  border-color: var(--border);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn .icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-btn .icon-sun {
  display: block;
}

:root[data-theme="dark"] .icon-btn .icon-moon {
  display: none;
}

/* Focus */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Bio / Intro */
.intro {
  margin-top: 28px;
  max-width: 58ch;
}

.intro p {
  margin: 0;
  color: var(--text-secondary);
}

.intro p + p {
  margin-top: 16px;
}

.inline-link {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

.inline-link:hover {
  text-decoration-color: var(--accent);
}

/* Sections */
.section {
  margin-top: 52px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.section-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.section-lead {
  margin: 10px 0 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

/* Writing List */
.link-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.link-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -12px;
  padding: 12px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s ease;
}

.link-row:hover {
  background-color: var(--surface-hover);
}

.link-row-main {
  min-width: 0;
}

.link-row-title {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.45;
}

.link-row-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-row-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.arrow {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.85em;
  color: var(--text-muted);
  transition: transform 0.18s ease, color 0.18s ease;
}

.link-row:hover .arrow {
  transform: translate(2px, -2px);
  color: var(--accent);
}

/* Experience List */
.exp-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.exp-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -12px;
  padding: 9px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s ease;
}

a.exp-row:hover {
  background-color: var(--surface-hover);
}

.exp-left {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-width: 0;
}

.exp-company {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.exp-role {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.exp-dates {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

a.exp-row .arrow {
  margin-left: 3px;
}

a.exp-row:hover .arrow {
  transform: translate(2px, -2px);
  color: var(--accent);
}

/* Time Capsule */
.capsule {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background-color: var(--surface);
  overflow: hidden;
}

.capsule-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.capsule-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}

.capsule-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-bar);
  box-shadow: 0 0 0 3px rgba(0, 204, 145, 0.14);
}

.capsule-date {
  font-variant-numeric: tabular-nums;
}

.capsule-body {
  margin: 0;
  padding: 16px 18px;
  font-size: 0.90625rem;
  line-height: 1.68;
  color: var(--text-secondary);
}

.capsule-ledger {
  margin: 0;
  padding: 13px 18px 15px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 9px;
}

.capsule-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 4px 12px;
  align-items: baseline;
  font-size: 0.8125rem;
}

.capsule-key {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.capsule-val {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  color: var(--text-secondary);
}

.capsule-sep {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.capsule-now {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 0.78125rem;
  font-weight: 500;
  color: var(--accent);
  background-color: rgba(0, 204, 145, 0.1);
}

.capsule-note {
  color: var(--text-muted);
}

/* iPhone App Showcase */
.phone-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 28px;
}

.phone-deck {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

.phone-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background-color: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background-color 0.15s ease,
    opacity 0.15s ease,
    transform 0.15s ease;
}

.phone-nav:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background-color: var(--surface-hover);
  transform: scale(1.04);
}

.phone-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.phone-nav svg {
  width: 16px;
  height: 16px;
}

.phone-frame {
  position: relative;
  width: 304px;
  max-width: 100%;
  padding: 10px;
  border-radius: 50px;
  background: linear-gradient(145deg, #27272a 0%, #161618 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 0 0 1px rgba(20, 20, 19, 0.14),
    0 20px 44px -16px rgba(0, 0, 0, 0.22),
    0 4px 12px -2px rgba(0, 0, 0, 0.08);
  user-select: none;
  -webkit-user-select: none;
}

:root[data-theme="dark"] .phone-frame {
  background: linear-gradient(145deg, #2b2b30 0%, #121214 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 24px 52px -16px rgba(0, 0, 0, 0.7),
    0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Subtle hardware side buttons */
.phone-frame::before {
  content: "";
  position: absolute;
  left: -2.5px;
  top: 112px;
  width: 2.5px;
  height: 36px;
  border-radius: 2px 0 0 2px;
  background: #3a3a3e;
  box-shadow: 0 48px 0 #3a3a3e;
}

.phone-frame::after {
  content: "";
  position: absolute;
  right: -2.5px;
  top: 132px;
  width: 2.5px;
  height: 54px;
  border-radius: 0 2px 2px 0;
  background: #3a3a3e;
}

.phone-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  aspect-ratio: 9 / 19.5;
  border-radius: 40px;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 10%, rgba(0, 204, 145, 0.18), transparent 52%),
    radial-gradient(circle at 14% 72%, rgba(120, 168, 224, 0.14), transparent 55%),
    linear-gradient(165deg, #f3f5f4 0%, #eaefed 48%, #eeece7 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

:root[data-theme="dark"] .phone-screen {
  background:
    radial-gradient(circle at 82% 10%, rgba(0, 204, 145, 0.2), transparent 54%),
    radial-gradient(circle at 14% 76%, rgba(62, 108, 196, 0.16), transparent 55%),
    linear-gradient(165deg, #101615 0%, #111318 52%, #151418 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.phone-status {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 22px 10px;
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.phone-time {
  font-variant-numeric: tabular-nums;
}

.phone-island {
  position: absolute;
  left: 50%;
  top: 9px;
  transform: translateX(-50%);
  width: 82px;
  height: 23px;
  border-radius: 999px;
  background: #0b0b0c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.phone-status-icons {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-primary);
}

.phone-status-icons svg {
  display: block;
}

/* Swipeable pages */
.phone-pages {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}

.phone-pages::-webkit-scrollbar {
  display: none;
}

.phone-pages.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto;
}

.phone-page {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 18px 14px 10px;
}

.springboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, 1fr);
  height: 100%;
  gap: 8px 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.sb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sb-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  text-decoration: none;
  color: inherit;
  -webkit-user-drag: none;
}

.sb-icon {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 12.5px;
  overflow: hidden;
  background-color: #ffffff;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 4px 10px rgba(0, 0, 0, 0.08);
  transition:
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.sb-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 38%);
  box-shadow: inset 0 0 0 1px var(--icon-ring);
  pointer-events: none;
}

.sb-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}

.sb-label {
  margin-top: 5px;
  width: 100%;
  font-size: 0.64rem;
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: balance;
}

div.sb-app .sb-label {
  color: var(--text-secondary);
}

a.sb-app:hover .sb-icon,
a.sb-app:focus-visible .sb-icon {
  transform: translateY(-2px) scale(1.06);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.14),
    0 10px 20px rgba(0, 0, 0, 0.1);
}

a.sb-app:active .sb-icon {
  transform: scale(0.95);
}

a.sb-app:focus-visible {
  outline: none;
}

a.sb-app:focus-visible .sb-icon {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Page indicator dots */
.phone-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 6px auto 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(20, 20, 19, 0.06);
}

:root[data-theme="dark"] .phone-dots {
  background: rgba(255, 255, 255, 0.08);
}

.phone-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.4;
  cursor: pointer;
  transition: opacity 0.18s ease, transform 0.18s ease, background-color 0.18s ease;
}

.phone-dot[aria-selected="true"] {
  opacity: 1;
  background: var(--text-primary);
  transform: scale(1.1);
}

/* Frosted Glass Dock */
.phone-dock-wrap {
  padding: 0 11px 8px;
}

.phone-dock {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 10px 10px 8px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

:root[data-theme="dark"] .phone-dock {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.phone-dock .sb-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
}

.phone-dock .sb-label {
  margin-top: 4px;
  font-size: 0.61rem;
  -webkit-line-clamp: 1;
}

.phone-home-bar {
  width: 108px;
  height: 4px;
  margin: 2px auto 8px;
  border-radius: 999px;
  background: rgba(20, 20, 19, 0.22);
}

:root[data-theme="dark"] .phone-home-bar {
  background: rgba(255, 255, 255, 0.28);
}

.phone-caption {
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

/* Shared icon container (used on support page) */
.app-icon {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  overflow: hidden;
  background-color: #ffffff;
  box-shadow: var(--icon-shadow);
}

.app-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 36%);
  box-shadow: inset 0 0 0 1px var(--icon-ring);
  pointer-events: none;
}

.app-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Support Page */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--text-primary);
}

.support-apps {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.support-app-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background-color: var(--surface);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

a.support-app-badge:hover {
  border-color: var(--border-strong);
  background-color: var(--surface-hover);
}

.support-app-badge .app-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  box-shadow: none;
}

.support-app-label {
  font-size: 0.875rem;
  font-weight: 500;
}

.support-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background-color: var(--surface);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.support-cta:hover {
  border-color: var(--accent);
  background-color: var(--surface-hover);
  transform: translateY(-1px);
}

/* Footer */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-note {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 520px) {
  .phone-nav {
    display: none;
  }

  .phone-frame {
    width: min(304px, 100%);
  }
}

@media (max-width: 440px) {
  .page {
    padding: 36px 20px 56px;
  }

  .header-nav {
    gap: 12px;
  }

  .link-row,
  .exp-row {
    flex-direction: column;
    gap: 2px;
  }

  .capsule-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .support-apps {
    flex-wrap: wrap;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page {
    animation: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
