:root {
  /* Subtle white-gray cat theme */
  --text: #2d2d2d;
  --muted: #7a7672;
  --line: #e6e4e0;
  --bg: #faf9f7;
  --accent: #8b7355;
  --radius: 4px;
  --shadow: 0 2px 8px rgba(45, 45, 45, 0.05);
  --shadow-lg: 0 8px 24px rgba(45, 45, 45, 0.06);
  --card-3d: 0 2px 4px rgba(45, 45, 45, 0.04), 0 4px 12px rgba(45, 45, 45, 0.05), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  --card-3d-hover: 0 8px 16px rgba(45, 45, 45, 0.06), 0 16px 40px rgba(45, 45, 45, 0.08), 0 2px 0 rgba(255, 255, 255, 0.8) inset;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

/* Skip link: visible on focus for keyboard/screen-reader users */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  padding: 10px 16px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius);
  z-index: 100;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 16px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .skip-link { transition: none; }
}

body {
  margin: 0;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  background: var(--bg);
  color: var(--text);
  perspective: 1200px;
  position: relative;
}

/* Moving background: slow gradient shift + soft drifting blobs */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    var(--bg),
    radial-gradient(ellipse 120% 80% at 70% 20%, rgba(139, 115, 85, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 80% 120% at 20% 80%, rgba(139, 115, 85, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse 100% 60% at 50% 50%, rgba(230, 228, 224, 0.15) 0%, transparent 55%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 120% 120%;
  background-position: 0 0, 0 0, 0 0, 0 0;
  animation: bgDrift 25s ease-in-out infinite;
}

@keyframes bgDrift {
  0%, 100% {
    background-position: 0 0, 0 0, 0 0, 0 0;
  }
  33% {
    background-position: 0 0, 12% 15%, -10% -8%, 8% 6%;
  }
  66% {
    background-position: 0 0, -15% -10%, 12% 18%, -6% 10%;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

.wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 48px 28px 100px;
  box-sizing: border-box;
  text-align: left;
  justify-self: stretch;
  transform-style: preserve-3d;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s ease;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 40px;
}

.site-header h1 {
  margin: 0;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 40px;
}

.lang-switch {
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: color 0.15s ease, background 0.15s ease;
}

.lang-switch:hover {
  color: var(--text);
  background: rgba(45, 45, 45, 0.04);
}

/* Keyboard hint — appears once, dismissible */
.keyboard-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -8px 0 16px;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--muted);
  background: rgba(45, 45, 45, 0.04);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.keyboard-hint-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
}
.keyboard-hint-text { flex: 1; }
.keyboard-hint-dismiss {
  background: none;
  border: none;
  padding: 0 4px;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.15s ease, background 0.15s ease;
}
.keyboard-hint-dismiss:hover {
  color: var(--text);
  background: rgba(45, 45, 45, 0.06);
}

.muted {
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Tabs */
.tabs {
  display: flex;
  justify-content: flex-start;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
  padding-bottom: 0;
  transform-style: preserve-3d;
}

.tab {
  background: none;
  border: none;
  padding: 8px 0;
  margin-bottom: -1px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, transform 0.2s ease;
}

.tab:hover {
  color: var(--text);
  transform: translateZ(4px);
}

@media (prefers-reduced-motion: reduce) {
  .tab:hover { transform: none; }
  .tab:active { transform: none; }
}

.tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 500;
}

.tab:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.tab:active {
  transform: translateZ(2px);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
  animation: panelFadeIn 0.35s ease, panelSlideUp 0.35s ease;
}

.panel.loading {
  min-height: 3em;
}

.panel.loading .loading-text {
  opacity: 0.7;
}

.about-cv.loading {
  min-height: 2em;
}

.about-cv.loading .loading-text {
  font-size: 0.9rem;
}

@keyframes panelFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes panelSlideUp {
  from { transform: translateY(8px); }
  to { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .panel.active { animation: none; }
  .sub-panel.active { animation: none; }
  .keyboard-hint,
  .keyboard-hint-hidden { transition: none; }
}

.panel p {
  margin: 0;
  max-width: 42em;
}

/* Tech & tools — moving strip */
.tech-strip-wrap {
  margin: 28px 0 0;
  width: 100%;
  max-width: 100%;
}

.cv-skills-strip {
  margin: 12px 0 0;
}

.tech-strip-label {
  margin: 0 0 12px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.tech-strip {
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}

.tech-strip-inner {
  display: flex;
  gap: 12px;
  width: max-content;
  animation: techScroll 30s linear infinite;
  padding: 4px 0;
}

.tech-strip-inner:hover {
  animation-play-state: paused;
}

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

.tech-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: #fdfcfb;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tech-pill img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  object-fit: contain;
  vertical-align: middle;
}

.tech-pill:hover {
  transform: translateZ(4px);
  box-shadow: var(--shadow);
}

@keyframes techScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.about-content {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-start;
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.about-cv {
  flex: 1 1 0;
  min-width: 0;
}

.about-glance {
  flex-shrink: 0;
  width: 100%;
  max-width: 240px;
}

.glance-card {
  background: #fdfcfb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 24px;
}

.glance-line {
  margin: 0 0 10px;
  font-size: 0.875rem;
  line-height: 1.4;
}

.glance-line:last-of-type {
  margin-bottom: 0;
}

.glance-focus {
  margin: 12px 0 14px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  padding-left: 10px;
  border-left: 2px solid var(--accent);
}

.glance-links {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.glance-links a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}

.glance-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.glance-sep {
  margin: 0 6px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .about-glance {
    max-width: 100%;
  }

  .glance-card {
    position: static;
  }
}

.panel-title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Sub-tabs (e.g. inside Hobbies) */
.sub-tabs {
  display: flex;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  margin: 16px 0 20px;
  padding-bottom: 0;
}

.sub-tab {
  background: none;
  border: none;
  padding: 6px 0;
  margin-bottom: -1px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease;
}

.sub-tab:hover {
  color: var(--text);
}

.sub-tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 500;
}

.sub-panel {
  display: none;
}

.sub-panel.active {
  display: block;
  animation: panelFadeIn 0.25s ease;
}

.sub-panel p {
  margin: 0;
  max-width: 42em;
}

/* Contact — neat & simple */
.contact-intro {
  margin: 0 0 28px;
  max-width: 28em;
  line-height: 1.6;
  font-size: 0.9rem;
}

.contact-card {
  max-width: 26em;
  background: #fdfcfb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  transform-style: preserve-3d;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.contact-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateZ(6px);
}

.contact-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  margin: 18px 0 6px;
}

.contact-form label:first-of-type {
  margin-top: 0;
}

.contact-form .label-hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.7rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 10px 0;
  font: inherit;
  font-size: 0.9rem;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--muted);
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-bottom-color: var(--text);
}

.contact-form textarea {
  resize: vertical;
  min-height: 100px;
  padding-top: 4px;
}

.contact-submit {
  margin-top: 24px;
  padding: 10px 20px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  background: var(--text);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.contact-submit:hover {
  opacity: 0.88;
}

.contact-direct {
  margin: 0;
  font-size: 0.85rem;
}

.contact-direct a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}

.contact-direct a:hover {
  color: var(--muted);
  border-bottom-color: var(--muted);
}

.contact-field-error {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: #b54;
  font-weight: 500;
}

/* Papers */
.papers-title {
  margin: 0 0 20px;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.papers-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 42em;
}

.papers-item {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

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

.papers-item a {
  display: block;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 4px;
  transition: color 0.15s ease;
}

.papers-item a:hover {
  color: var(--muted);
}

.papers-item .muted {
  font-size: 0.875rem;
  display: block;
}

/* CV (inside About) — full width of main area */
.cv {
  max-width: 100%;
  transform-style: preserve-3d;
}

/* Cards in main content */
.panel .contact-card,
#about-cv .cv {
  position: relative;
}

.cv-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 24px;
}

.cv-name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.cv-top .muted {
  margin: 4px 0 0;
}

.cv-section {
  margin: 28px 0 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.cv-section:first-of-type {
  margin-top: 0;
}

.cv .line {
  border: none;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

.cv-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cv-tags span {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: #fdfcfb;
  border: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--text);
}

.cv-item {
  margin-top: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

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

.cv-section-hint {
  margin: -4px 0 12px;
  font-size: 0.8rem;
}

.cv-item-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.cv-item-toggle:hover {
  opacity: 0.85;
}

.cv-item-toggle:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.cv-item-head {
  flex: 1;
  min-width: 0;
}

.cv-item-chevron {
  flex-shrink: 0;
  font-size: 0.65rem;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.cv-item:not(.collapsed) .cv-item-chevron {
  transform: rotate(-180deg);
}

.cv-item-body {
  padding-top: 12px;
  overflow: hidden;
  transition: padding-top 0.2s ease, opacity 0.2s ease;
}

.cv-item.collapsed .cv-item-body {
  display: none;
}

.cv-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.cv-row strong {
  font-weight: 600;
  font-size: 0.9375rem;
}

.cv-item .muted {
  margin: 6px 0 0;
  font-size: 0.875rem;
}

.cv-location {
  margin: 4px 0 0;
  font-size: 0.875rem;
}

.cv-grade {
  margin: 2px 0 0;
  font-size: 0.875rem;
}

.cv-bullets {
  margin: 12px 0 0;
  padding-left: 1.25em;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.55;
}

.cv-bullets li {
  margin-bottom: 8px;
}

.cv-bullets li:last-child {
  margin-bottom: 0;
}

.cv-bullet-highlight {
  border-left: 3px solid var(--text);
  padding-left: 12px;
  margin-left: 0.5em;
  font-weight: 500;
  color: var(--text);
}

.cv-keyword {
  font-weight: 600;
  color: var(--text);
}

/* CV icons */
.cv-icons {
  display: flex;
  gap: 16px;
  align-items: center;
}

.cv-icons a {
  display: inline-flex;
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: color 0.15s ease;
}

.cv-icons a:hover {
  color: var(--text);
}

.cv-icons svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

/* Calendar aside – 3D panel */
.calendar {
  padding: 24px 24px 28px;
  border-left: 3px solid var(--accent);
  min-width: 220px;
  max-width: 300px;
  background: linear-gradient(180deg, #fdfcfb 0%, #f8f6f3 100%);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform-style: preserve-3d;
  perspective: 800px;
  position: relative;
  box-shadow:
    -8px 0 24px rgba(45, 45, 45, 0.04),
    -4px 0 12px rgba(45, 45, 45, 0.03),
    inset 1px 0 0 rgba(255, 255, 255, 0.6);
}

.calendar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(139, 115, 85, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.aside-doodle {
  width: 560px;
  max-width: 100%;
  aspect-ratio: 2 / 1;
  margin-bottom: 8px;
}

.aside-doodle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Aside cards – shared 3D base */
.clock-card,
.calendar-card,
.aside-info.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transform-style: preserve-3d;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  box-shadow: var(--card-3d);
}
.clock-card:hover,
.calendar-card:hover,
.aside-info.card:hover {
  transform: translateZ(12px) rotateY(-2deg) rotateX(1deg);
  box-shadow: var(--card-3d-hover);
}

@media (prefers-reduced-motion: reduce) {
  .clock-card:hover,
  .calendar-card:hover,
  .aside-info.card:hover {
    transform: none;
  }
}

.clock-card {
  padding: 18px 20px;
  text-align: center;
  border-top: 2px solid var(--accent);
}

.clock {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.clock-time {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.2;
}

.clock-date {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.calendar-card,
.aside-info.card {
  padding: 16px 18px 18px;
}

.calendar-month {
  margin: 0 0 14px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-align: center;
}

.aside-info-line {
  margin: 0 0 8px;
  font-size: 0.875rem;
  line-height: 1.4;
}

.aside-info-line:last-child {
  margin-bottom: 0;
}

.aside-info-line.aside-note {
  font-size: 0.8125rem;
}

.aside-focus {
  font-weight: 600;
  color: var(--text);
  padding: 6px 0;
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  margin-left: -2px;
}

.aside-note-icon {
  margin-right: 4px;
  opacity: 0.8;
}

.aside-link {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.aside-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-size: 0.8125rem;
  text-align: center;
}

.grid .day {
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 6px 0 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}

.grid .cell {
  padding: 8px 0;
  border-radius: var(--radius);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.grid .cell:not(.today):hover {
  background: var(--line);
}

.grid .today {
  background: var(--text);
  color: #fff;
  font-weight: 600;
}

/* Footer */
footer {
  position: fixed;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
}

footer a {
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.footer-sep {
  margin: 0 8px;
  color: var(--muted);
}

.tab-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}
.tab-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

@media (max-width: 820px) {
  body {
    grid-template-columns: 1fr;
  }

  .wrap {
    padding: 32px 20px 80px;
    max-width: 100%;
  }

  .calendar {
    border-left: none;
    border-top: 1px solid var(--line);
    padding: 28px 20px;
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .wrap {
    padding: 24px 16px 72px;
  }

  h1 {
    font-size: 1.5rem;
    margin-bottom: 24px;
  }
}
