:root {
  /* Page and gradient backgrounds. */
  --bg: #fffaf5;
  --bg-gradient-end: #fffaf5;

  /* Surface backgrounds. */
  --surface: #fffaf5;
  --surface-muted: #fffaf5;
  --header-bg: #fffaf5;
  --surface-overlay: #fffaf5;
  --overlay: #2b211c9e;

  /* Soft fills and emphasis backgrounds. */
  --accent-soft: #d5baa2;
  --job-header-bg: #d5baa2;
  --button-soft-bg: #d5baa2;
  --inline-code-bg: #d5baa2;
  --portrait-border: #d5baa2;

  /* Text and interactive colors. */
  --text: #3b2c23;
  --text-soft: #6e5a4b;
  --accent: #6484ec;

  /* Borders and shadows. */
  --line: #b5967e;
  --shadow-color: #3b2c231a;
  --shadow-color-strong: #3b2c232e;
  --shadow: 0 10px 25px var(--shadow-color);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-gradient-end) 100%);
  color: var(--text-soft);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  line-height: 1.6;
}

body.modal-open {
  overflow: hidden;
}

p,
h1,
h2,
h3,
h4,
li,
a,
button,
input,
textarea {
  overflow-wrap: anywhere;
  word-break: break-word;
}

h1,
h2,
h3,
h4,
h5,
h6,
strong,
b,
label {
  color: var(--text);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.top-nav {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
}

.nav-links {
  gap: 0.8rem;
  flex-wrap: wrap;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.nav-toggle-icon {
  width: 16px;
  height: 2px;
  background: var(--text);
  position: relative;
  display: inline-block;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  background: var(--text);
}

.nav-toggle-icon::before {
  top: -5px;
}

.nav-toggle-icon::after {
  top: 5px;
}

.nav-toggle-label {
  font-size: 0.9rem;
}

.nav-social {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.nav-social-link {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  transition: transform 180ms ease, background 180ms ease;
  cursor: pointer;
}

.nav-social-link:hover,
.nav-social-link:focus-visible {
  transform: translateY(-2px);
  background: var(--accent-soft);
}

.nav-social-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  pointer-events: none;
}

.nav-link {
  text-decoration: none;
  color: var(--text);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.35rem 0.5rem;
  border-bottom: 2px solid transparent;
  transition: border-color 220ms ease, color 220ms ease;
}

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

#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.3rem 1rem 4rem;
}

.section {
  background: var(--surface);
  margin: 1.2rem 0;
  padding: 1.5rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  scroll-margin-top: 96px;
}

.section-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.85rem;
  margin-bottom: 0.8rem;
}

.section-subtitle {
  color: var(--text-soft);
  margin-bottom: 1rem;
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 500ms ease, transform 500ms ease;
}

.reveal.show {
  opacity: 1;
  transform: translateY(0);
}

.intro-wrap {
  text-align: center;
  display: grid;
  gap: 0.8rem;
  justify-items: center;
}

.portrait {
  width: clamp(120px, 60vw, 400px);
  height: auto;
  display: block;
  border-radius: 16px;
  object-fit: initial;
  border: 4px solid var(--portrait-border);
}

.intro-wrap h3 {
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  line-height: 1.3;
  max-width: 100%;
}

.intro-links {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-link {
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: var(--button-soft-bg);
  transition: transform 180ms ease, background 180ms ease;
}

.icon-link:hover,
.icon-link:focus-visible {
  transform: translateY(-2px);
}

.link-separator {
  color: var(--line);
  font-weight: 700;
}

.job-grid {
  display: grid;
  gap: 1rem;
}

.job-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.job-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  background: var(--job-header-bg);
  padding: 0.8rem 1rem;
}

.job-logo {
  width: 230px;
  height: 100px;
  border-radius: 10px;
  object-fit: contain;
  object-position: center;
  background: var(--surface);
  padding: 0.35rem;
}

.role-list {
  padding: 0.9rem 1rem 1rem;
  display: grid;
  gap: 0.9rem;
}

.role-header {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin-bottom: 0.35rem;
}

.role-period {
  margin: 0 0 0 auto;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  background: var(--button-soft-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.role-block ul {
  margin-left: 1.1rem;
}

.gallery-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gallery-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-muted);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.gallery-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px var(--shadow-color-strong);
}

.carousel {
  position: relative;
  height: 180px;
  overflow: hidden;
}

.carousel-media {
  width: 100%;
  height: 100%;
}

.carousel-media img,
.carousel-media iframe {
  width: 100%;
  height: 100%;
  display: block;
}

.carousel-media img {
  object-fit: contain;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  background: var(--surface-overlay);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

.carousel-btn.left {
  left: 8px;
}

.carousel-btn.right {
  right: 8px;
}

.card-content {
  padding: 0.8rem 1rem 1rem;
}

.card-content h3,
.card-content p,
.modal-body h3,
.modal-body p,
.role-block h4,
.role-block p,
.role-block li,
.section-title,
.section-subtitle,
.intro-wrap p {
  hyphens: auto;
}

.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
  overscroll-behavior: contain;
}

.overlay.show {
  display: flex;
  animation: fadeIn 220ms ease;
}

.modal {
  background: var(--surface);
  width: min(1400px, 100vw);
  border-radius: 0;
  overflow: hidden;
  border: none;
  max-height: 100vh;
  height: auto;
  display: flex;
  flex-direction: column;
}

.modal-close {
  border: none;
  background: var(--button-soft-bg);
  padding: 0.5rem 0.8rem;
  margin: 0.6rem;
  border-radius: 8px;
  cursor: pointer;
}

.modal-body {
  padding: 0 1rem 1rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal .carousel {
  height: min(78vh, 900px);
  border-radius: 10px;
  margin-bottom: 0.8rem;
  background: var(--surface-muted);
}

.modal .carousel img,
.modal .carousel iframe {
  object-fit: contain;
  object-position: center;
}

.modal-rich-text {
  display: grid;
  gap: 0.6rem;
  color: var(--text-soft);
}

.modal-rich-text h1,
.modal-rich-text h2,
.modal-rich-text h3 {
  margin: 0.2rem 0;
  line-height: 1.2;
}

.modal-rich-text h1 {
  font-size: 1.35rem;
}

.modal-rich-text h2 {
  font-size: 1.15rem;
}

.modal-rich-text h3 {
  font-size: 1rem;
}

.modal-rich-text ul {
  padding-left: 1.15rem;
  display: grid;
  gap: 0.25rem;
}

.modal-rich-text a {
  color: var(--accent);
  font-weight: 700;
}

.modal-rich-text code {
  background: var(--inline-code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.05rem 0.35rem;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.9em;
}


.contact-wrap {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  align-items: start;
}

.contact-photo {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.contact-message {
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.contact-links {
  display: grid;
  gap: 0.4rem;
}

.contact-links a {
  display: inline-block;
  width: fit-content;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.contact-links a:hover,
.contact-links a:focus-visible {
  text-decoration: underline;
}

.site-footer {
  text-align: center;
  color: var(--text-soft);
  padding: 1rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-links,
  .nav-social {
    display: none;
    width: 100%;
  }

  .top-nav.menu-open .nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding-top: 0.4rem;
  }

  .top-nav.menu-open .nav-social {
    display: flex;
    justify-content: center;
    padding-bottom: 0.3rem;
  }

  .nav-link {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid transparent;
  }

  .section {
    padding: 1.1rem;
  }

  .section-title {
    font-size: 1.55rem;
    line-height: 1.25;
  }

  .section-subtitle {
    line-height: 1.4;
  }

  .job-header {
    grid-template-columns: 1fr;
  }

  .job-logo {
    justify-self: start;
    width: 76px;
    height: 76px;
  }

  .role-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .role-period {
    margin-left: auto;
  }

  .card-content {
    padding: 0.8rem;
  }

  .intro-wrap h3 {
    font-size: 1.15rem;
    padding: 0 0.2rem;
  }

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

  .overlay {
    padding: 0;
  }

  .modal .carousel {
    height: 62vh;
  }

  .contact-wrap {
    grid-template-columns: 1fr;
  }

  .contact-photo {
    max-height: 280px;
  }
}

@media (max-width: 380px) {
  .top-nav {
    padding: 0.65rem 0.75rem;
  }

  .section {
    padding: 0.95rem;
  }

  .section-title {
    font-size: 1.35rem;
  }

  .intro-wrap h3 {
    font-size: 1rem;
    line-height: 1.35;
  }

  .nav-link {
    font-size: 0.86rem;
    letter-spacing: 0.01em;
  }

  .intro-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
  }

  .icon-link {
    padding: 0.3rem 0.55rem;
  }

  .role-list {
    padding: 0.75rem;
  }

  .job-logo {
    width: 68px;
    height: 68px;
  }

  .role-period {
    font-size: 0.82rem;
    padding: 0.15rem 0.45rem;
  }
}
