:root {
  --black: #050508;
  --text: #e8c97a;
  --text-dim: rgba(232, 201, 122, 0.52);
  --text-faint: rgba(232, 201, 122, 0.28);
  --accent: #e8a030;
  --line: rgba(232, 201, 122, 0.14);
  --fade: 420ms;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --vh: 1vh;
}

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

::selection {
  background: rgba(232, 160, 48, 0.3);
  color: var(--text);
}

::-moz-selection {
  background: rgba(232, 160, 48, 0.3);
  color: var(--text);
}

body {
  background: var(--black);
  color: var(--text);
  font-family: 'Georgia', serif;
  overflow: hidden;
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
  width: 100vw;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-overflow-scrolling: touch;
}

#topo-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.45;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 999;
  background: var(--accent);
  color: var(--black);
  padding: 10px 18px;
  border-radius: 6px;
  font-family: 'Sentient', serif;
  font-size: 13px;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 16px;
}

nav {
  position: fixed;
  top: calc(14px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: rgba(8, 7, 4, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 3px 4px;
  display: flex;
  align-items: center;
  gap: 1px;
  white-space: nowrap;
}

nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.05em;
  font-family: 'Sentient', serif;
  font-weight: 200;
  transition: color 0.3s, text-shadow 0.3s, background 0.2s;
  cursor: pointer;
  user-select: none;
  position: relative;
  padding: 5px 12px;
  min-height: 28px;
  display: flex;
  align-items: center;
  border-radius: 16px;
}

nav a:hover {
  color: rgba(232, 201, 122, 0.85);
  text-shadow: 0 0 18px rgba(232, 160, 48, 0.2);
  background: rgba(232, 201, 122, 0.06);
}

nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

nav a.active {
  color: var(--text);
  background: rgba(232, 160, 48, 0.08);
}

.page {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(64px + var(--safe-top)) calc(10vw + var(--safe-right)) calc(80px + var(--safe-bottom)) calc(10vw + var(--safe-left));
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transform: translateY(-18px);
  transition: opacity var(--fade) ease, transform var(--fade) ease;
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
  overscroll-behavior: contain;
}

.page.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
  overflow-y: auto;
  overflow-x: hidden;
}

.page::-webkit-scrollbar {
  width: 4px;
}

.page::-webkit-scrollbar-track {
  background: transparent;
}

.page::-webkit-scrollbar-thumb {
  background: rgba(232, 201, 122, 0.22);
  border-radius: 4px;
}

.page {
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 201, 122, 0.22) transparent;
}

#page-home {
  justify-content: center;
}

.social-portals {
  display: flex;
  gap: 14px;
  margin-bottom: 40px;
}

.portal-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(232, 201, 122, 0.06);
  border: 1px solid rgba(232, 201, 122, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  transition: background 0.25s, border-color 0.25s, transform 0.2s;
}

.portal-btn:hover {
  background: rgba(232, 160, 48, 0.18);
  border-color: var(--accent);
  transform: translateY(-3px);
}

.portal-btn:active {
  transform: translateY(-1px) scale(0.96);
}

.portal-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.portal-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.home-name {
  font-family: 'Sentient', serif;
  font-style: italic;
  font-size: clamp(36px, 5.2vw, 72px);
  font-weight: 200;
  line-height: 1.05;
  margin-bottom: 18px;
}

.home-sub {
  font-family: 'Times New Roman', serif;
  font-size: clamp(13px, 1.4vw, 18px);
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-bottom: 28px;
}

.typing-wrapper {
  font-family: 'Times New Roman', serif;
  font-size: clamp(14px, 1.4vw, 19px);
  color: rgba(232, 201, 122, 0.7);
  min-height: 32px;
  display: flex;
  align-items: center;
}

.cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent);
  margin-left: 2px;
  animation: blink 0.85s step-end infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0
  }
}

.section-divider {
  width: 44px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.6;
  margin-bottom: 36px;
  flex-shrink: 0;
}

.section-title {
  font-family: 'Sentient', serif;
  font-size: clamp(28px, 4vw, 54px);
  font-weight: 200;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.section-sub {
  font-family: 'Times New Roman', serif;
  color: var(--text-faint);
  font-size: 15px;
  margin-bottom: 48px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

#page-projects {
  justify-content: flex-start;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  max-width: 1100px;
}

.project-card {
  background: rgba(232, 201, 122, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.35s, transform 0.35s, box-shadow 0.35s;
}

.project-card:hover {
  border-color: rgba(232, 160, 48, 0.38);
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(232, 160, 48, 0.08), 0 0 0 1px rgba(232, 160, 48, 0.12);
}

.project-card:active {
  transform: translateY(-2px);
}

.card-img {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #0d0d18, #1b1428);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.card-body {
  padding: 22px;
}

.card-title {
  font-family: 'Sentient', serif;
  font-size: 19px;
  font-weight: 200;
  margin-bottom: 10px;
  color: var(--text);
}

.card-desc {
  font-family: 'Times New Roman', serif;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.72;
  margin-bottom: 16px;
}

.card-links {
  display: flex;
  gap: 12px;
}

.card-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-family: 'Times New Roman', serif;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: opacity 0.2s;
  min-height: 44px;
}

.card-link:hover {
  opacity: 0.65;
}

.card-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

#page-writing {
  justify-content: flex-start;
}

.writing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  max-width: 1100px;
}

.note-card {
  background: rgba(232, 201, 122, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.35s, transform 0.35s, box-shadow 0.35s;
  cursor: pointer;
  user-select: none;
}

.note-card:hover {
  border-color: rgba(232, 160, 48, 0.38);
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(232, 160, 48, 0.08), 0 0 0 1px rgba(232, 160, 48, 0.12);
}

.note-card:active {
  transform: translateY(-2px);
}

.note-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.note-card-banner {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, #0d0d18 0%, #1a1028 40%, #0f1420 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.note-card-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(232, 160, 48, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 30%, rgba(232, 201, 122, 0.05) 0%, transparent 50%);
}

.note-card-banner-icon {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.6;
}

.note-card-body {
  padding: 22px;
}

.note-card-tag {
  display: inline-block;
  font-family: 'Sentient', serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(232, 160, 48, 0.1);
  border: 1px solid rgba(232, 160, 48, 0.18);
  border-radius: 20px;
  padding: 3px 12px;
  margin-bottom: 14px;
}

.note-card-title {
  font-family: 'Sentient', serif;
  font-size: 18px;
  font-weight: 200;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.4;
}

.note-card-excerpt {
  font-family: 'Times New Roman', serif;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.72;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  font-family: 'Times New Roman', serif;
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

.note-card-footer svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.note-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(5, 5, 8, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fade) ease;
}

.note-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.note-overlay::-webkit-scrollbar {
  width: 4px;
}

.note-overlay::-webkit-scrollbar-track {
  background: transparent;
}

.note-overlay::-webkit-scrollbar-thumb {
  background: rgba(232, 201, 122, 0.22);
  border-radius: 4px;
}

.note-overlay {
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 201, 122, 0.22) transparent;
}

.note-detail {
  width: 100%;
  max-width: 1100px;
  padding: calc(64px + var(--safe-top)) calc(32px + var(--safe-right)) calc(100px + var(--safe-bottom)) calc(32px + var(--safe-left));
  transform: translateY(18px);
  transition: transform var(--fade) ease;
}

.note-overlay.open .note-detail {
  transform: translateY(0);
}

.note-detail-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px;
  align-items: start;
}

.note-sidebar {
  position: sticky;
  top: 110px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.ref-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(232, 201, 122, 0.02);
  padding: 20px;
  transition: border-color 0.3s;
}

.ref-section:hover {
  border-color: rgba(232, 160, 48, 0.25);
}

.ref-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.ref-section-header svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.ref-section-title {
  font-family: 'Sentient', serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.ref-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(232, 201, 122, 0.06);
  text-decoration: none;
  transition: opacity 0.25s;
}

.ref-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.ref-item:hover {
  opacity: 0.7;
}

.ref-item-num {
  font-family: 'Sentient', serif;
  font-size: 11px;
  font-weight: 400;
  color: var(--accent);
  opacity: 0.6;
  min-width: 18px;
  padding-top: 2px;
  flex-shrink: 0;
}

.ref-item-info {
  flex: 1;
  min-width: 0;
}

.ref-item-title {
  font-family: 'Times New Roman', serif;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ref-item-source {
  font-family: 'Times New Roman', serif;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.03em;
}

.ref-item-arrow {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  margin-top: 3px;
  opacity: 0.5;
}

.note-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Sentient', serif;
  font-size: 13px;
  font-weight: 200;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 8px 20px;
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s;
  margin-bottom: 40px;
  min-height: 44px;
}

.note-back-btn:hover {
  color: var(--text);
  border-color: rgba(232, 160, 48, 0.38);
}

.note-back-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.note-back-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.note-detail-tag {
  display: inline-block;
  font-family: 'Sentient', serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(232, 160, 48, 0.1);
  border: 1px solid rgba(232, 160, 48, 0.18);
  border-radius: 20px;
  padding: 3px 12px;
  margin-bottom: 18px;
}

.note-detail-title {
  font-family: 'Sentient', serif;
  font-size: clamp(24px, 3.2vw, 40px);
  font-weight: 200;
  line-height: 1.3;
  margin-bottom: 14px;
  color: var(--text);
}

.note-detail-meta {
  font-family: 'Times New Roman', serif;
  font-size: 13px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  margin-bottom: 36px;
}

.note-detail-divider {
  width: 44px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.5;
  margin-bottom: 36px;
}

.note-detail-body {
  font-family: 'Times New Roman', serif;
  font-size: 16px;
  color: rgba(232, 201, 122, 0.72);
  line-height: 2;
  letter-spacing: 0.01em;
}

.note-detail-body p {
  margin-bottom: 22px;
}

.note-detail-body .note-quote {
  border-left: 2px solid rgba(232, 160, 48, 0.35);
  padding-left: 20px;
  margin: 28px 0;
  font-style: italic;
  color: rgba(232, 201, 122, 0.58);
  line-height: 1.9;
}

.note-detail-body .note-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 22px;
}

.note-detail-body .note-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 8px;
}

.note-detail-body .note-list li::before {
  content: '\2014';
  position: absolute;
  left: 0;
  color: var(--accent);
  opacity: 0.5;
}

.note-detail-body .note-heading {
  font-family: 'Sentient', serif;
  font-size: 19px;
  font-weight: 400;
  color: var(--text);
  margin-top: 36px;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

#page-resume {
  align-items: center;
  text-align: center;
  justify-content: center;
}

.coming-soon-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.coming-icon {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.coming-icon svg {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.coming-icon .ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(232, 201, 122, 0.1);
  border-radius: 50%;
  animation: pulse-ring 3s ease-in-out infinite;
}

.coming-icon .ring:nth-child(2) {
  inset: -8px;
  animation-delay: 0.8s;
  border-color: rgba(232, 201, 122, 0.06);
}

.coming-icon .ring:nth-child(3) {
  inset: -16px;
  animation-delay: 1.6s;
  border-color: rgba(232, 201, 122, 0.03);
}

@keyframes pulse-ring {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.08);
    opacity: 0.5;
  }
}

.coming-soon {
  font-family: 'Sentient', serif;
  font-style: italic;
  font-size: clamp(18px, 2.5vw, 32px);
  font-weight: 200;
  color: var(--text-faint);
  letter-spacing: 0.07em;
}

.coming-hint {
  font-family: 'Times New Roman', serif;
  font-size: 14px;
  color: rgba(232, 201, 122, 0.2);
  max-width: 340px;
  line-height: 1.7;
}

.coming-line {
  width: 32px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
}

#page-about {
  justify-content: flex-start;
}

.about-layout {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 60px;
  max-width: 980px;
  align-items: start;
}

.about-name {
  font-family: 'Sentient', serif;
  font-size: clamp(22px, 2.9vw, 42px);
  font-weight: 200;
  line-height: 1.2;
  margin-bottom: 26px;
}

.about-text p {
  font-family: 'Times New Roman', serif;
  font-size: 15px;
  color: rgba(232, 201, 122, 0.68);
  line-height: 1.88;
  margin-bottom: 20px;
}

.about-text a {
  color: var(--accent);
  text-decoration: none;
}

.about-text a:hover {
  text-decoration: underline;
}

.about-text a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.about-img-box {
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: rgba(232, 201, 122, 0.03);
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.35s, box-shadow 0.35s;
}

.about-img-box:hover {
  border-color: rgba(232, 160, 48, 0.25);
  box-shadow: 0 8px 32px rgba(232, 160, 48, 0.06);
}

.about-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.about-img-box:hover img {
  transform: scale(1.03);
}

.site-footer {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  font-family: 'Times New Roman', serif;
  font-size: 11px;
  color: rgba(232, 201, 122, 0.14);
  letter-spacing: 0.07em;
  pointer-events: none;
}

@media (max-width: 860px) {
  .note-detail-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .note-sidebar {
    position: static;
    order: -1;
  }

  .note-detail {
    padding: calc(56px + var(--safe-top)) calc(24px + var(--safe-right)) calc(80px + var(--safe-bottom)) calc(24px + var(--safe-left));
  }
}

@media (max-width: 768px) {
  nav {
    gap: 0;
    padding: 4px 4px;
    top: calc(10px + var(--safe-top));
    width: calc(100% - 20px);
    justify-content: space-around;
    border-radius: 24px;
  }

  nav a {
    font-size: 10px;
    letter-spacing: 0.04em;
    padding: 8px 6px;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
    border-radius: 14px;
    -webkit-tap-highlight-color: transparent;
  }

  .page {
    padding: calc(70px + var(--safe-top)) calc(16px + var(--safe-right)) calc(80px + var(--safe-bottom)) calc(16px + var(--safe-left));
  }

  .about-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .about-img-box {
    max-width: 220px;
    justify-self: center;
  }

  .projects-grid,
  .writing-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .section-sub {
    margin-bottom: 32px;
    font-size: 14px;
  }

  .social-portals {
    flex-wrap: wrap;
    gap: 10px;
  }

  .portal-btn {
    width: 48px;
    height: 48px;
    -webkit-tap-highlight-color: transparent;
  }

  .home-name {
    font-size: clamp(28px, 8vw, 42px);
  }

  .home-sub {
    font-size: clamp(12px, 3.5vw, 16px);
  }

  .typing-wrapper {
    font-size: clamp(13px, 3.5vw, 16px);
  }

  .card-body,
  .note-card-body {
    padding: 18px;
  }

  .card-title,
  .note-card-title {
    font-size: 17px;
  }

  .card-desc,
  .note-card-excerpt {
    font-size: 13px;
  }

  .card-link {
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
  }

  .note-card {
    -webkit-tap-highlight-color: transparent;
  }

  .note-detail {
    padding: 56px 16px 60px;
  }

  .note-detail-title {
    font-size: clamp(20px, 5vw, 28px);
  }

  .note-detail-body {
    font-size: 15px;
  }

  .note-back-btn {
    min-height: 48px;
    padding: 10px 20px;
    -webkit-tap-highlight-color: transparent;
  }

  .section-divider {
    margin-bottom: 24px;
  }

  .section-title {
    margin-bottom: 10px;
  }

  .coming-soon-wrap {
    gap: 20px;
  }

  .coming-icon {
    width: 70px;
    height: 70px;
  }

  .site-footer {
    bottom: 12px;
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  nav {
    padding: 3px 3px;
    top: calc(8px + var(--safe-top));
    width: calc(100% - 16px);
  }

  nav a {
    font-size: 9px;
    padding: 8px 4px;
    min-height: 44px;
    min-width: 44px;
  }

  .page {
    padding: calc(64px + var(--safe-top)) calc(14px + var(--safe-right)) calc(70px + var(--safe-bottom)) calc(14px + var(--safe-left));
  }

  .home-name {
    font-size: clamp(24px, 7vw, 32px);
    margin-bottom: 14px;
  }

  .home-sub {
    font-size: clamp(11px, 3vw, 14px);
    margin-bottom: 20px;
  }

  .typing-wrapper {
    font-size: clamp(12px, 3vw, 14px);
    min-height: 28px;
  }

  .section-title {
    font-size: clamp(22px, 6vw, 28px);
  }

  .section-sub {
    font-size: 13px;
    margin-bottom: 24px;
  }

  .card-body,
  .note-card-body {
    padding: 14px;
  }

  .card-title,
  .note-card-title {
    font-size: 16px;
  }

  .card-desc,
  .note-card-excerpt {
    font-size: 12px;
    line-height: 1.6;
  }

  .card-tags {
    gap: 4px;
  }

  .card-tag,
  .note-card-tag {
    font-size: 9px;
    padding: 2px 8px;
  }

  .note-detail {
    padding: calc(48px + var(--safe-top)) calc(12px + var(--safe-right)) calc(50px + var(--safe-bottom)) calc(12px + var(--safe-left));
  }

  .note-detail-title {
    font-size: clamp(18px, 4.5vw, 24px);
  }

  .note-detail-body {
    font-size: 14px;
    line-height: 1.8;
  }

  .note-detail-body .note-heading {
    font-size: 17px;
    margin-top: 24px;
    margin-bottom: 10px;
  }

  .note-detail-body .note-quote {
    padding-left: 14px;
    margin: 20px 0;
  }

  .note-back-btn {
    font-size: 12px;
    padding: 8px 16px;
    margin-bottom: 24px;
  }

  .ref-section {
    padding: 14px;
  }

  .ref-section-title {
    font-size: 11px;
  }

  .ref-item-title {
    font-size: 12px;
  }

  .about-name {
    font-size: clamp(20px, 5vw, 28px);
  }

  .about-text p {
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 16px;
  }

  .about-img-box {
    max-width: 180px;
  }

  .social-portals {
    gap: 8px;
  }

  .portal-btn {
    width: 44px;
    height: 44px;
  }

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

  .coming-soon {
    font-size: clamp(16px, 4vw, 24px);
  }

  .coming-hint {
    font-size: 13px;
    max-width: 280px;
  }
}

/* ─── Staggered entrance animations ─── */

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeSlideRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.page.active .section-divider,
.page.active .section-title,
.page.active .section-sub,
.page.active .about-name {
  animation: fadeSlideRight 0.6s ease both;
}

.page.active .section-title {
  animation-delay: 0.08s;
}

.page.active .section-sub {
  animation-delay: 0.16s;
}

.page.active .project-card,
.page.active .note-card {
  animation: fadeSlideUp 0.5s ease both;
}

.page.active .project-card:nth-child(1),
.page.active .note-card:nth-child(1) {
  animation-delay: 0.15s;
}

.page.active .project-card:nth-child(2),
.page.active .note-card:nth-child(2) {
  animation-delay: 0.25s;
}

.page.active .project-card:nth-child(3),
.page.active .note-card:nth-child(3) {
  animation-delay: 0.35s;
}

.page.active .project-card:nth-child(4),
.page.active .note-card:nth-child(4) {
  animation-delay: 0.45s;
}

.page.active .about-layout {
  animation: fadeSlideUp 0.6s ease 0.1s both;
}

.page.active .about-text p:nth-child(1) {
  animation: fadeSlideUp 0.5s ease 0.2s both;
}

.page.active .about-text p:nth-child(2) {
  animation: fadeSlideUp 0.5s ease 0.3s both;
}

.page.active .about-text p:nth-child(3) {
  animation: fadeSlideUp 0.5s ease 0.4s both;
}

/* ─── Tech tags on project cards ─── */

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.card-tag {
  font-family: 'Sentient', serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(232, 160, 48, 0.08);
  border: 1px solid rgba(232, 160, 48, 0.15);
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
}

/* ─── Nav pill indicator ─── */

nav .nav-pill {
  position: absolute;
  height: 26px;
  background: rgba(232, 160, 48, 0.1);
  border: 1px solid rgba(232, 160, 48, 0.2);
  border-radius: 14px;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: -1;
  top: 50%;
  transform: translateY(-50%);
}

/* ─── Social button glow ─── */

.portal-btn {
  position: relative;
  overflow: visible;
}

.portal-btn::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 160, 48, 0.2), transparent 70%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.portal-btn:hover::before {
  opacity: 1;
}

/* ─── Project card image hover overlay ─── */

.card-img {
  position: relative;
  overflow: hidden;
}

.card-img img {
  transition: transform 0.6s ease;
}

.project-card:hover .card-img img {
  transform: scale(1.06);
}

.card-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(5, 5, 8, 0.7) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.project-card:hover .card-img::after {
  opacity: 1;
}

/* ─── Footer separator ─── */

.site-footer::before {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 201, 122, 0.15), transparent);
  margin: 0 auto 10px;
}

/* ─── Social portal entrance stagger ─── */

.page.active .portal-btn {
  animation: fadeSlideUp 0.4s ease both;
}

.page.active .portal-btn:nth-child(1) {
  animation-delay: 0.05s;
}

.page.active .portal-btn:nth-child(2) {
  animation-delay: 0.1s;
}

.page.active .portal-btn:nth-child(3) {
  animation-delay: 0.15s;
}

.page.active .portal-btn:nth-child(4) {
  animation-delay: 0.2s;
}

.page.active .portal-btn:nth-child(5) {
  animation-delay: 0.25s;
}

/* ─── Home elements entrance ─── */

.page.active .home-name {
  animation: fadeSlideUp 0.6s ease 0.1s both;
}

.page.active .home-sub {
  animation: fadeSlideUp 0.5s ease 0.2s both;
}

.page.active .typing-wrapper {
  animation: fadeSlideUp 0.5s ease 0.35s both;
}

/* ─── Smooth card link underline ─── */

.card-link {
  position: relative;
}

.card-link::after {
  content: '';
  position: absolute;
  bottom: 10px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.card-link:hover::after {
  width: 100%;
}

.card-link:hover {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  #topo-canvas {
    display: none;
  }
}

@media (max-width: 360px) {
  .page {
    padding: calc(60px + var(--safe-top)) calc(12px + var(--safe-right)) calc(60px + var(--safe-bottom)) calc(12px + var(--safe-left));
  }

  nav {
    width: calc(100% - 12px);
  }

  nav a {
    font-size: 8px;
    padding: 8px 3px;
  }

  .home-name {
    font-size: 22px;
  }

  .home-sub {
    font-size: 11px;
  }

  .typing-wrapper {
    font-size: 11px;
  }

  .section-title {
    font-size: 20px;
  }

  .card-body,
  .note-card-body {
    padding: 12px;
  }

  .card-title,
  .note-card-title {
    font-size: 15px;
  }

  .note-detail {
    padding: calc(40px + var(--safe-top)) calc(10px + var(--safe-right)) calc(40px + var(--safe-bottom)) calc(10px + var(--safe-left));
  }

  .note-detail-title {
    font-size: 18px;
  }

  .note-detail-body {
    font-size: 13px;
  }

  .note-detail-body .note-heading {
    font-size: 15px;
  }

  .about-name {
    font-size: 20px;
  }

  .about-text p {
    font-size: 13px;
  }

  .about-img-box {
    max-width: 150px;
  }

  .portal-btn {
    width: 40px;
    height: 40px;
  }

  .portal-btn svg {
    width: 14px;
    height: 14px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .project-card:hover,
  .note-card:hover {
    transform: none;
    box-shadow: none;
  }

  .project-card:active,
  .note-card:active {
    transform: scale(0.98);
  }

  .portal-btn:hover {
    transform: none;
  }

  .portal-btn:active {
    transform: scale(0.95);
  }

  .card-link:hover {
    opacity: 1;
  }

  .card-link::after {
    display: none;
  }

  .project-card:hover .card-img img {
    transform: none;
  }

  .about-img-box:hover img {
    transform: none;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .page {
    padding-top: calc(56px + var(--safe-top));
    padding-bottom: calc(60px + var(--safe-bottom));
  }

  nav {
    top: calc(6px + var(--safe-top));
    padding: 2px 4px;
  }

  nav a {
    min-height: 36px;
    padding: 4px 8px;
  }

  .home-name {
    font-size: clamp(24px, 4vw, 36px);
    margin-bottom: 10px;
  }

  .home-sub {
    font-size: clamp(12px, 1.5vw, 15px);
    margin-bottom: 14px;
  }

  .typing-wrapper {
    font-size: clamp(13px, 1.5vw, 16px);
    min-height: 24px;
  }

  .section-title {
    font-size: clamp(22px, 3vw, 32px);
    margin-bottom: 8px;
  }

  .section-sub {
    font-size: 13px;
    margin-bottom: 16px;
  }

  .section-divider {
    margin-bottom: 16px;
  }

  .card-img {
    height: 120px;
  }

  .note-card-banner {
    height: 100px;
  }

  .about-layout {
    gap: 24px;
  }

  .about-name {
    font-size: clamp(20px, 2.5vw, 28px);
    margin-bottom: 16px;
  }

  .about-text p {
    font-size: 14px;
    margin-bottom: 12px;
  }

  .about-img-box {
    max-width: 160px;
  }
}

body.is-scrolling * {
  animation-play-state: paused !important;
}

@media print {
  nav,
  .social-portals,
  .site-footer,
  #topo-canvas {
    display: none !important;
  }

  body {
    overflow: visible;
    height: auto;
  }

  .page {
    position: static;
    opacity: 1;
    pointer-events: all;
    transform: none;
    height: auto;
    page-break-inside: avoid;
  }

  .page:not(.active) {
    display: none;
  }
}