/* ============================================================
   CUSTOM PROPERTIES
   ============================================================ */
:root {
  --c-bg:          #000000;
  --c-surface:     #080808;
  --c-surface-2:   #0f0f0f;
  --c-border:      #1c1c1c;
  --c-border-h:    #2e2e2e;
  --c-text:        #f0f0f0;
  --c-text-dim:    #888888;
  --c-text-muted:  #444444;
  --c-accent:      #ff3333;
  --c-accent-dim:  rgba(255, 51, 51, 0.12);

  --font: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;

  --fs-xs:   0.7rem;
  --fs-sm:   0.8125rem;
  --fs-base: 1rem;
  --fs-lg:   1.25rem;
  --fs-xl:   1.75rem;
  --fs-hero: clamp(3.5rem, 9vw, 8rem);

  --sp-xs:  0.375rem;
  --sp-sm:  0.75rem;
  --sp-md:  1.5rem;
  --sp-lg:  3rem;
  --sp-xl:  5rem;
  --sp-sec: clamp(4rem, 10vh, 7rem);

  --container: 60rem;
  --pad:       clamp(1.25rem, 5vw, 2.5rem);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur:  0.5s;
}

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

html {
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--c-bg);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

ul[role="list"] {
  list-style: none;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.section {
  padding: var(--sp-sec) 0;
  min-height: 100dvh;
  scroll-snap-align: start;
}

/* ============================================================
   SECTION HEADING
   ============================================================ */
.section__heading {
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--c-accent);
  letter-spacing: 0.04em;
  margin-bottom: var(--sp-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}

.section__heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-border);
}

/* ============================================================
   ACCENT INLINE
   ============================================================ */
.accent {
  color: var(--c-text);
}

/* ============================================================
   HERO
   ============================================================ */
.section--hero {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--c-border);
}

#ascii-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  user-select: none;
}

.hero__prefix {
  font-size: var(--fs-sm);
  color: #808080;
  margin-bottom: var(--sp-sm);
  letter-spacing: 0.05em;
  width: max-content;
  margin-left: auto;
  margin-right: auto;
  background: rgba(0,0,0,0.88);
  padding: 2px 10px;
}

.hero__title {
  font-size: var(--fs-hero);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: var(--c-text);
  margin-bottom: var(--sp-md);
  width: max-content;
  margin-left: auto;
  margin-right: auto;
  background: rgba(0,0,0,0.88);
  padding: 4px 16px 8px;
}

.hero__subtitle {
  font-size: var(--fs-lg);
  font-weight: 300;
  color: #c0c0c0;
  letter-spacing: 0.01em;
  width: max-content;
  margin-left: auto;
  margin-right: auto;
  background: rgba(0,0,0,0.88);
  padding: 2px 12px;
}

.hero__sep {
  color: var(--c-accent);
}

.hero__meta {
  font-size: var(--fs-sm);
  color: #808080;
  margin-top: var(--sp-xs);
  width: max-content;
  margin-left: auto;
  margin-right: auto;
  background: rgba(0,0,0,0.88);
  padding: 2px 10px;
}

.hero__scroll {
  position: absolute;
  bottom: var(--sp-lg);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: var(--c-accent);
  background: rgba(0,0,0,0.88);
  padding: 2px 10px;
  transition: color 0.3s;
  animation: float 2.5s ease-in-out infinite;
}

.hero__scroll:hover {
  color: var(--c-accent);
}

.hero__scroll-char {
  font-size: var(--fs-base);
  user-select: none;
  -webkit-user-select: none;
}

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(6px); }
}

/* ============================================================
   ABOUT
   ============================================================ */
.about__body {
  max-width: 42rem;
}

.about__text {
  font-size: var(--fs-base);
  color: var(--c-text-dim);
  line-height: 1.8;
}

.about__text + .about__text {
  margin-top: var(--sp-md);
}

/* ============================================================
   PROJECTS
   ============================================================ */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  gap: var(--sp-md);
}

.project-card {
  display: flex;
  flex-direction: column;
  padding: var(--sp-md);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: var(--c-surface);
  transition:
    border-color var(--dur) var(--ease),
    background   var(--dur) var(--ease),
    transform    0.3s       var(--ease);
  cursor: pointer;
}

.project-card:hover {
  border-color: var(--c-accent);
  background: var(--c-surface-2);
  transform: translateY(-3px);
}

.project-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-sm);
}

.project-card__name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.4;
}

.project-card__arrow {
  font-size: var(--fs-base);
  color: var(--c-text-muted);
  flex-shrink: 0;
  transition: color 0.3s, transform 0.3s;
}

.project-card:hover .project-card__arrow {
  color: var(--c-accent);
  transform: translate(2px, -2px);
}

.project-card__desc {
  font-size: var(--fs-sm);
  color: var(--c-text-dim);
  line-height: 1.7;
  flex: 1;
  margin-bottom: var(--sp-md);
}

.project-card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
}

/* Tags */
.tag {
  font-size: var(--fs-xs);
  padding: 0.2em 0.65em;
  border-radius: 3px;
  border: 1px solid transparent;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.tag--swift   { color: #f05138; border-color: rgba(240, 81, 56, 0.35); }
.tag--swiftui { color: #4fa8e8; border-color: rgba(79, 168, 232, 0.35); }
.tag--ios     { color: #a0a0a0; border-color: rgba(160, 160, 160, 0.25); }

/* ============================================================
   SKILLS
   ============================================================ */
.skills__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}

.skill-tag {
  font-size: var(--fs-sm);
  padding: 0.35em 0.9em;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  color: var(--c-text-dim);
  background: var(--c-surface);
  transition:
    border-color 0.3s,
    color        0.3s,
    background   0.3s;
  cursor: default;
}

.skill-tag:hover {
  border-color: var(--c-accent);
  color: var(--c-text);
  background: var(--c-accent-dim);
}

/* Non-hero sections: vertically center their content */
.section--page {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#setup > .container {
  min-height: calc(100dvh - (var(--sp-sec) * 2));
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   SETUP — LINK CATEGORIES
   ============================================================ */
.setup__categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: var(--sp-xl);
  flex: 1;
  min-height: 0;
  width: 100%;
}

.setup__category {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.setup__cat-label {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--c-accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--sp-sm);
}

#setup .section__heading {
  width: 100%;
}

.setup__links {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.setup__link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--c-border);
  transition: border-color 0.3s;
}

.setup__link:last-child {
  border-bottom: none;
}

.setup__link:hover {
  border-color: var(--c-border-h);
}

.setup__link-platform {
  font-size: var(--fs-sm);
  color: var(--c-text-dim);
}

.setup__link-handle {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  transition: color 0.3s;
}

.setup__link:hover .setup__link-handle {
  color: var(--c-accent);
}

/* ============================================================
   SPECS CARD
   ============================================================ */
.specs-card {
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: var(--c-surface);
  overflow: hidden;
}

.specs-card__heading {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--c-accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: var(--sp-md);
  border-bottom: 1px solid var(--c-border);
}

.specs-card__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.specs-col {
  padding: var(--sp-sm) 0;
}

.specs-col:first-child {
  border-right: 1px solid var(--c-border);
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-md);
  padding: 0.4rem var(--sp-md);
  border-bottom: 1px solid var(--c-border);
  transition: background 0.2s;
}

.spec-row:last-child {
  border-bottom: none;
}

.spec-row:hover {
  background: var(--c-surface-2);
}

.spec-row__key {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
  min-width: 5.5rem;
}

.spec-row__val {
  font-size: var(--fs-xs);
  color: var(--c-text-dim);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding: var(--sp-lg) 0;
  border-top: 1px solid var(--c-border);
}

.footer__text {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.footer__link {
  transition: color 0.3s;
}

.footer__link:hover {
  color: var(--c-accent);
}

/* ============================================================
   SCROLL ANIMATIONS
   ============================================================ */
[data-animate] {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity   var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .specs-card__body {
    grid-template-columns: 1fr;
  }

  .specs-col:first-child {
    border-right: none;
    border-bottom: 1px solid var(--c-border);
  }

  .setup__categories {
    grid-template-columns: 1fr;
    gap: var(--sp-lg);
  }

  .projects__grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
/* ============================================================
   SCROLL LOCK BUTTON (touch only)
   ============================================================ */

.scroll-lock-btn {
  display: none;
  align-items: center;
  justify-content: center;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  width: 2.75rem;
  height: 2.75rem;
  background: rgba(0, 0, 0, 0.88);
  border: 1px solid var(--c-border);
  color: var(--c-text-muted);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.25s, color 0.25s, box-shadow 0.25s, background 0.25s;
  -webkit-user-select: none;
  user-select: none;
}

.scroll-lock-btn__icon {
  width: 1.1rem;
  height: 1.1rem;
}

.scroll-lock-btn__icon--locked   { display: none; }
.scroll-lock-btn__icon--unlocked { display: block; }

.scroll-lock-btn.is-locked {
  border-color: var(--c-accent);
  color: var(--c-accent);
}

.scroll-lock-btn.is-locked .scroll-lock-btn__icon--locked   { display: block; }
.scroll-lock-btn.is-locked .scroll-lock-btn__icon--unlocked { display: none; }

@media (pointer: coarse) {
  .scroll-lock-btn { display: flex; }

  body {
    -webkit-user-select: none;
    user-select: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  [data-animate] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero__scroll {
    animation: none;
  }

  .project-card,
  .skill-tag,
  .setup__link,
  .spec-row {
    transition: none;
  }
}
