:root {
  color-scheme: dark;
  --bg: #0a0e17;
  --header: #0b101b;
  --surface: #101827;
  --surface-hover: #152238;
  --text: #f0f4fc;
  --muted: #a0aec4;
  --line: #233147;
  --blue: #78a9ff;
  --blue-soft: #152746;
  --accent-start: #87b7ff;
  --accent-end: #6895ff;
  --action: #3567ed;
  --action-hover: #2958db;
  --grid: #4362941e;
  --hero-glow: #1d4cca22;
  --shadow: #03091360;
  --font: "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f8fe;
  --header: #fcfdff;
  --surface: #ffffff;
  --surface-hover: #edf3ff;
  --text: #14233d;
  --muted: #51627b;
  --line: #d8e2f1;
  --blue: #2458cb;
  --blue-soft: #e9f0ff;
  --accent-start: #2455ce;
  --accent-end: #365dd7;
  --action: #2659d9;
  --action-hover: #1948ba;
  --grid: #4b71bc20;
  --hero-glow: #2868ff15;
  --shadow: #315aa71a;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 280px;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.65 var(--font);
  word-break: keep-all;
}

button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
button:focus-visible, a:focus-visible, select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
}

.wrap {
  width: min(100% - 6rem, 75rem);
  margin-inline: auto;
}

.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  position: fixed;
  z-index: 5;
  top: 0.65rem;
  left: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
}

.icon {
  display: block;
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--header);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 4.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 0.65rem;
  white-space: nowrap;
  font-size: 1.27rem;
  font-weight: 760;
  line-height: 1;
  letter-spacing: -0.05em;
}

.brand-mark {
  width: 2.15rem;
  height: auto;
  flex: 0 0 auto;
}

.brand-period { color: var(--blue); }

.main-nav {
  display: flex;
  gap: clamp(1.25rem, 3.3vw, 2.75rem);
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 600;
}

.main-nav a:hover, .footer-top:hover { color: var(--blue); }

.preferences {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.language-control, .icon-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.55rem;
}

.language-control:hover, .icon-button:hover {
  background: var(--surface-hover);
  border-color: var(--blue);
}

.language-control .icon, .language-control::after {
  position: absolute;
  pointer-events: none;
}

.language-control .icon { left: 0.65rem; color: var(--muted); width: 1rem; height: 1rem; }

.language-control::after {
  content: "";
  right: 0.75rem;
  width: 0.33rem;
  height: 0.33rem;
  margin-top: -0.2rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
}

.language-control select {
  min-height: 2.55rem;
  padding: 0 1.65rem 0 1.95rem;
  appearance: none;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: inherit;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.language-control option { background: var(--surface); }
.icon-button { width: 2.65rem; padding: 0; }
.theme-button .moon, [data-theme="light"] .theme-button .sun { display: none; }
[data-theme="light"] .theme-button .moon { display: block; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 1.2rem;
  min-height: 33.5rem;
  padding-block: 4rem;
  isolation: isolate;
}

.hero::before {
  position: absolute;
  z-index: -1;
  inset: 0 0 0 24%;
  content: "";
  background:
    radial-gradient(ellipse at 66% 46%, var(--hero-glow), transparent 68%),
    radial-gradient(circle, var(--grid) 1px, transparent 1.5px) 0 0 / 19px 19px;
  mask-image: radial-gradient(ellipse at 67% 47%, #000 22%, transparent 73%);
}

.hero-copy { position: relative; z-index: 1; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--blue);
  font: 600 0.88rem/1.4 var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin-bottom: 1.15rem;
}

.eyebrow-line { width: 1.6rem; height: 1px; background: currentColor; }

.hero h1 {
  font-size: clamp(2.7rem, 5.4vw, 5.25rem);
  font-weight: 770;
  line-height: 1.06;
  letter-spacing: -0.073em;
}

:lang(ko) .hero h1 {
  font-size: clamp(2.55rem, 5.05vw, 4.8rem);
  font-weight: 760;
  line-height: 1.14;
  letter-spacing: -0.075em;
}

.hero h1 span { display: block; }

.hero-accent {
  color: var(--blue);
  background: linear-gradient(110deg, var(--accent-start), var(--accent-end));
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-summary {
  max-width: 32rem;
  margin-top: 1.4rem;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.72;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.65rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.6rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 0.57rem;
  font-size: 0.96rem;
  font-weight: 650;
}

.button-primary {
  color: white;
  border-color: #96b3ff47;
  background: var(--action);
  box-shadow: 0 7px 24px -10px #3c6df3bb;
}

.button-primary:hover { background: var(--action-hover); }
.button-secondary { background: var(--surface); }
.button-secondary:hover { background: var(--surface-hover); border-color: var(--blue); }

.hero-visual {
  position: relative;
  width: 100%;
  aspect-ratio: 1.36;
  margin: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 55% 52%, #143366, #0a1020 70%);
  border: 1px solid #658fe34a;
  border-radius: 1.15rem;
  box-shadow: 0 25px 60px -25px var(--shadow);
}

.hero-visual img { width: 100%; height: 100%; object-fit: cover; }

.frame-corner {
  position: absolute;
  width: 0.8rem;
  height: 0.8rem;
  border: solid #8bb1fc9c;
  border-width: 1px 0 0 1px;
}

.top-left { top: 0.85rem; left: 0.85rem; }
.top-right { top: 0.85rem; right: 0.85rem; transform: rotate(90deg); }
.bottom-left { bottom: 0.85rem; left: 0.85rem; transform: rotate(-90deg); }
.bottom-right { bottom: 0.85rem; right: 0.85rem; transform: rotate(180deg); }

.section, #contact, #main { scroll-margin-top: 6rem; }
.section { padding-block: 2.65rem 3.7rem; border-top: 1px solid var(--line); }
.section-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.35rem; }
.section h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); line-height: 1.19; letter-spacing: -0.047em; font-weight: 730; }
.section-header p, .about-copy p { margin-top: 0.55rem; color: var(--muted); }
.carousel-controls { display: flex; flex: 0 0 auto; align-items: center; gap: 0.44rem; }
.slide-count {
  margin-right: 0.45rem;
  color: var(--muted);
  font: 0.85rem var(--mono);
  white-space: nowrap;
}

#slide-number { color: var(--blue); }

.project-panel {
  display: grid;
  grid-template-columns: 0.9fr 1.35fr;
  min-height: 19.5rem;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  touch-action: pan-y pinch-zoom;
}

.project-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  padding: clamp(1.4rem, 4vw, 3.25rem);
}

.project-category {
  color: var(--blue);
  font: 600 0.85rem/1.4 var(--mono);
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.project-copy h3 {
  margin-top: 0.6rem;
  font-size: clamp(1.85rem, 3vw, 2.85rem);
  line-height: 1.07;
  letter-spacing: -0.052em;
}

.project-summary { margin-top: 0.9rem; color: var(--muted); }
.project-tags { display: flex; flex-wrap: wrap; gap: 0.38rem; padding: 0; margin: 1.2rem 0 0; list-style: none; }
.project-tags li {
  padding: 0.23rem 0.55rem;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 0.35rem;
  font: 0.81rem/1.5 var(--mono);
}

.project-visual { position: relative; min-height: 17.5rem; overflow: hidden; background: #101b33; }
.project-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.project-visual img.slide-in { animation: slide-in 230ms ease-out; }

@keyframes slide-in {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

.project-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.7rem;
}

.project-option {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 4.25rem;
  padding: 0.5rem 0.65rem;
  text-align: start;
  overflow-wrap: anywhere;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  font-size: 0.93rem;
  font-weight: 650;
}

.project-option:hover { color: var(--text); background: var(--surface-hover); }
.project-option[aria-pressed="true"] { color: var(--text); border-color: var(--blue); background: var(--blue-soft); }
.project-option img { flex: 0 0 auto; width: 3.55rem; height: 2.4rem; border-radius: 0.3rem; object-fit: cover; }

.skills-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; }
.skill-card { padding: 1.25rem; border: 1px solid var(--line); border-radius: 0.75rem; background: var(--surface); }
.skill-icon {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  margin-bottom: 0.85rem;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 0.55rem;
}

.skill-icon .icon { width: 1.25rem; height: 1.25rem; }
.skill-card h3, .contact-card h3 { font-size: 1.08rem; font-weight: 720; }
.skill-card p, .contact-card p { margin-top: 0.3rem; color: var(--muted); font-size: 0.92rem; }

.about { display: grid; grid-template-columns: 1.4fr 1fr; align-items: center; gap: clamp(1.4rem, 6vw, 5rem); }
.about-copy p { max-width: 39rem; }
.contact-card { padding: 1.25rem; border: 1px solid var(--line); border-radius: 0.75rem; background: var(--surface); }
.contact-email { display: inline-block; margin-top: 0.25rem; color: var(--blue); overflow-wrap: anywhere; }
.contact-email:hover { text-decoration: underline; }

.site-footer { border-top: 1px solid var(--line); background: var(--header); }
.footer-inner { display: flex; align-items: center; gap: 1rem; padding-block: 1.25rem; }
.footer-inner p, .footer-top { color: var(--muted); font-size: 0.88rem; }
.footer-top { margin-left: auto; white-space: nowrap; }

@media (max-width: 950px) {
  .wrap { width: min(100% - 3rem, 75rem); }
  .hero { min-height: 28rem; padding-block: 3rem; }
  .project-panel { grid-template-columns: 1fr 1.2fr; }
}

@media (max-width: 710px) {
  .wrap { width: calc(100% - 2rem); }
  .header-inner { grid-template-columns: minmax(0, 1fr) auto; gap: 0.15rem 0.6rem; padding-block: 0.65rem 0; }
  .main-nav { grid-row: 2; grid-column: 1 / -1; justify-content: space-between; gap: 0.25rem; }
  .main-nav a { padding-block: 0.6rem; }
  .hero { grid-template-columns: 1fr; padding-block: 2.8rem 2rem; gap: 1.8rem; }
  .hero h1 { font-size: clamp(2.6rem, 9vw, 4.2rem); }
  :lang(ko) .hero h1 { font-size: clamp(2.25rem, 8.5vw, 4rem); }
  .hero-visual { aspect-ratio: 1.55; }
  .section, #contact, #main { scroll-margin-top: 7rem; }
  .section { padding-block: 2rem 2.5rem; }
  .section-header { align-items: flex-start; flex-wrap: wrap; }
  .section-header p { font-size: 0.98rem; }
  .project-panel { grid-template-columns: 1fr; }
  .project-copy { padding: 1.4rem; }
  .project-visual { grid-row: 1; min-height: 0; aspect-ratio: 1.7; }
  .project-picker { gap: 0.35rem; }
  .project-option { flex-direction: column; justify-content: start; align-items: stretch; gap: 0.35rem; padding: 0.4rem; line-height: 1.25; font-size: 0.88rem; }
  .project-option img { width: 100%; height: auto; aspect-ratio: 2 / 1; }
  .skills-grid, .about { grid-template-columns: 1fr; }
  .footer-inner { flex-wrap: wrap; }
  .footer-inner p { order: 1; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .project-visual img.slide-in { animation: none; }
}
