:root {
  --primary: #1a6b85;
  --primary-dark: #134d61;
  --primary-light: #2d8aad;
  --primary-soft: #d6eaf2;
  --primary-muted: #e8f3f8;
  --accent: #c47d1a;
  --accent-soft: #fef3e2;
  --page-bg: #dde6ee;
  --panel: #ffffff;
  --panel-alt: #f4f8fb;
  --text: #1a2b3c;
  --text-muted: #4a5f73;
  --border: #b8ccd8;
  --border-light: #d4e2ea;
  --shadow: 0 1px 3px rgba(19, 77, 97, 0.12), 0 5px 14px rgba(19, 77, 97, 0.08);
  --shadow-hover: 0 4px 8px rgba(19, 77, 97, 0.14), 0 12px 28px rgba(19, 77, 97, 0.12);
  --radius: 12px;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  min-height: 100%;
  background-color: var(--page-bg);
  overflow-x: clip;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
  position: relative;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    url("../images/background/bridge.png"),
    url("../images/background/liberty.png"),
    url("../images/background/sydney.png"),
    url("../images/background/golden.png"),
    url("../images/background/london.png");
  background-size:
    min(580px, 58vw) auto,
    min(540px, 54vw) auto,
    min(500px, 50vw) auto,
    min(480px, 48vw) auto,
    min(460px, 46vw) auto;
  background-position:
    left 0 bottom 0,
    right 0 top 10%,
    right 2% bottom 0,
    left 0 top 8%,
    left 32% bottom 0;
  background-repeat: no-repeat;
  background-attachment: fixed;
  opacity: 0.95;
  filter: saturate(1.08) drop-shadow(0 6px 18px rgba(19, 77, 97, 0.1));
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent);
}

.container {
  width: min(1140px, 92%);
  margin: 0 auto;
}

main {
  position: relative;
  z-index: 1;
  flex: 1;
}

/* Header */
.site-header {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  color: var(--text);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
  border-bottom: 2px solid var(--border);
}

.flag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  align-items: center;
}

.flag-row img {
  height: 20px;
  width: auto;
  max-width: none;
  flex-shrink: 0;
  object-fit: contain;
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: inline-block;
  vertical-align: middle;
}

.header-flags {
  padding: 0.35rem 0 0.45rem;
  border-top: 1px solid var(--border-light);
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(214, 234, 242, 0.85) 20%,
    rgba(254, 243, 226, 0.85) 80%,
    transparent 100%
  );
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 1.05rem;
}

.logo:hover {
  color: var(--primary);
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: var(--primary-soft);
  border: 2px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.logo-text small {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.nav-toggle {
  display: none;
  background: var(--panel-alt);
  border: 2px solid var(--border);
  color: var(--primary-dark);
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 0.25rem;
}

.main-nav a {
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
  border: 2px solid transparent;
}

.main-nav a:hover,
.main-nav a.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: var(--border);
}

/* Hero */
.hero {
  background:
    linear-gradient(135deg, rgba(214, 234, 242, 0.92) 0%, rgba(232, 240, 246, 0.88) 45%, rgba(254, 243, 226, 0.9) 100%);
  color: var(--text);
  padding: 2.5rem 0 3rem;
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid var(--border);
}

.hero-flags {
  justify-content: flex-start;
  margin-bottom: 0.75rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-grid > div:first-child {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin-bottom: 0.5rem;
  line-height: 1.3;
  color: var(--primary-dark);
}

.hero-subject {
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 1rem;
  font-size: 1.05rem;
}

.hero-welcome {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.hero-welcome-en {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-actions-main {
  margin-top: 0.25rem;
}

.hero-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--panel);
  box-shadow: var(--shadow-hover);
  outline: 3px solid var(--primary);
  background: var(--panel);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  font-family: inherit;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: var(--panel);
  box-shadow: 0 3px 10px rgba(26, 107, 133, 0.3);
  border: 2px solid var(--primary-dark);
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: var(--panel);
}

.btn-featured {
  padding: 0.75rem 1.55rem;
  font-size: 1rem;
  box-shadow: 0 4px 14px rgba(26, 107, 133, 0.35);
}

.btn-featured-materials {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
  color: var(--panel);
  border: 2px solid var(--primary-dark);
}

.btn-featured-materials:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: var(--panel);
}

.btn-featured-quiz {
  background: linear-gradient(135deg, #a85f10 0%, var(--accent) 55%, #e09a3a 100%);
  color: var(--panel);
  border: 2px solid #9a5510;
  box-shadow: 0 4px 14px rgba(196, 125, 26, 0.35);
}

.btn-featured-quiz:hover {
  background: linear-gradient(135deg, #8f4f0c 0%, #b86a15 100%);
  color: var(--panel);
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

/* Sections */
.section {
  padding: 3.5rem 0;
  background: transparent;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
  padding-left: 1rem;
  border-left: 4px solid var(--primary);
}

.section-subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  padding-left: 1.15rem;
  font-weight: 600;
}

.page-header {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
  color: var(--text);
  padding: 2.25rem 0;
  text-align: center;
  border-bottom: 2px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.page-header .container {
  background: rgba(232, 243, 248, 0.65);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  max-width: min(1140px, 92%);
  position: relative;
  z-index: 1;
}

.page-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  color: var(--primary-dark);
}

.page-header p {
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-weight: 600;
}

/* Quiz page */
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.quiz-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  min-height: 100%;
}

.quiz-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
  color: inherit;
}

.quiz-card-badge {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent-soft);
  color: #8f4f0c;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(196, 125, 26, 0.25);
}

.quiz-card h2 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--primary-dark);
  margin-bottom: 0.6rem;
  line-height: 1.35;
}

.quiz-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex: 1;
  margin-bottom: 1.25rem;
  font-weight: 600;
  line-height: 1.55;
}

.quiz-card-action {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--primary);
}

.quiz-card:hover .quiz-card-action {
  color: var(--accent);
}

.quiz-note {
  margin-top: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 1rem 1.25rem;
  background: var(--panel);
  border-radius: var(--radius);
  border: 2px solid var(--border-light);
}

/* Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  border: 2px solid var(--border);
  border-radius: 10px;
}

.card h3 {
  font-family: var(--font-serif);
  color: var(--primary-dark);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Features strip */
.features-strip {
  background: transparent;
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  padding: 2rem 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  text-align: center;
}

.features-grid > div {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  box-shadow: var(--shadow);
}

.feature-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.feature-label {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.35rem;
  font-weight: 600;
}

/* Portfolio */
.portfolio-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.portfolio-sidebar {
  position: sticky;
  top: 90px;
}

.portfolio-photo {
  width: 100%;
  border-radius: var(--radius);
  border: 3px solid var(--panel);
  box-shadow: var(--shadow);
  outline: 2px solid var(--primary);
  margin-bottom: 1rem;
  background: var(--panel);
}

.portfolio-nav {
  list-style: none;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
}

.portfolio-nav a {
  display: block;
  padding: 0.75rem 1.25rem;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
  font-size: 0.92rem;
}

.portfolio-nav a:hover,
.portfolio-nav a.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-left: 4px solid var(--primary);
  padding-left: calc(1.25rem - 4px);
}

.portfolio-section {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  scroll-margin-top: 100px;
  border: 2px solid var(--border);
}

.portfolio-section h2 {
  font-family: var(--font-serif);
  color: var(--primary-dark);
  font-size: 1.4rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-soft);
}

.quote {
  background: var(--accent-soft);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-style: italic;
  color: var(--text);
  border-radius: 0 8px 8px 0;
  border: 2px solid #f0d9b8;
  border-left: 4px solid var(--accent);
}

.portfolio-section p {
  margin-bottom: 0.75rem;
  color: var(--text);
}

.portfolio-nav li:last-child a {
  border-bottom: none;
}

.info-list {
  list-style: none;
}

.info-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}

.info-list li::before {
  content: "📌";
  flex-shrink: 0;
}

.certificates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.certificate-card {
  display: flex;
  flex-direction: column;
  background: var(--panel-alt);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.certificate-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.certificate-preview {
  width: 100%;
  height: 160px;
  object-fit: cover;
  object-position: top;
  background: var(--primary-muted);
  border-bottom: 2px solid var(--border-light);
}

.certificate-title {
  padding: 0.65rem 0.75rem 0.25rem;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.certificate-action {
  padding: 0 0.75rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}

/* Materials */
.materials-section-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.materials-section-link {
  padding: 0.55rem 1.25rem;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--panel);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.2s;
}

.materials-section-link:hover,
.materials-section-link.active {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: var(--panel);
}

.materials-toolbar {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  border: 2px solid var(--border);
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.65rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  background: var(--panel-alt);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--panel);
}

.filter-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-tag {
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  border: 2px solid var(--border);
  background: var(--panel-alt);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
}

.filter-tag:hover,
.filter-tag.active {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: var(--panel);
}

.materials-count {
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-weight: 700;
  background: var(--panel);
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  border: 2px solid var(--border);
}

.material-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  margin-bottom: 1rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: start;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.material-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
}

.material-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-soft);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.material-body h3 {
  font-size: 1rem;
  color: var(--primary-dark);
  margin-bottom: 0.35rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.material-body h3 a {
  color: inherit;
}

.material-body h3 a:hover {
  color: var(--accent);
}

.material-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

.material-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.75rem;
}

.badge-kim {
  background: #e8f4fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

.badge-kos {
  background: #f3e8fd;
  color: #6a1b9a;
  border: 1px solid #ce93d8;
}

.badge-fos {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.badge-sr {
  background: #fff8e1;
  color: #f57f17;
  border: 1px solid #ffe082;
}

.badge-up {
  background: #e0f7fa;
  color: #00695c;
  border: 1px solid #80deea;
}

.badge-rp {
  background: #fce4ec;
  color: #ad1457;
  border: 1px solid #f48fb1;
}

.badge-article {
  background: #efebe9;
  color: #4e342e;
  border: 1px solid #bcaaa4;
}

.badge-umk {
  background: #cce5f0;
  color: #0c4a6e;
  border: 1px solid #7eb8d4;
}

.badge-methods {
  background: #d4edda;
  color: #155724;
  border: 1px solid #8fc99e;
}

.badge-default {
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #b0bec9;
}

.material-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-end;
}

.no-results {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* Feedback */
.feedback-single {
  max-width: 640px;
  margin: 0 auto;
}

.feedback-info {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
}

.feedback-info h2 {
  font-family: var(--font-serif);
  color: var(--primary-dark);
  margin-bottom: 1rem;
}

.feedback-info p {
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.feedback-mail-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

/* Footer */
.site-footer {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  color: var(--text-muted);
  padding: 2rem 0 1.5rem;
  margin-top: auto;
  border-top: 3px solid var(--primary);
  box-shadow: 0 -4px 16px rgba(19, 77, 97, 0.06);
  position: relative;
  z-index: 1;
}

.footer-grid ul {
  list-style: none;
}

.footer-grid li {
  margin-bottom: 0.4rem;
}

.footer-bottom {
  border-top: 2px solid var(--border-light);
  padding-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.footer-grid h4 {
  color: var(--primary-dark);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  font-weight: 800;
}

.footer-grid a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.footer-grid a:hover {
  color: var(--primary);
}

.section-alt {
  background: rgba(232, 243, 248, 0.55);
  backdrop-filter: blur(4px);
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  padding-top: 2.5rem;
  padding-bottom: 3.5rem;
  position: relative;
}

.section-alt .card {
  background: var(--panel);
}

/* Responsive */
@media (max-width: 900px) {
  body::before {
    background-size:
      min(320px, 62vw) auto,
      min(300px, 58vw) auto,
      min(280px, 54vw) auto,
      min(260px, 50vw) auto,
      min(240px, 46vw) auto;
    background-position:
      left 0 bottom 0,
      right 0 top 8%,
      right 0 bottom 0,
      left 0 top 6%,
      center;
    opacity: 0.9;
  }

  .flag-row img {
    height: 18px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-photo {
    margin: 0 auto;
    width: 160px;
    height: 160px;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-flags {
    justify-content: center;
  }

  .portfolio-layout {
    grid-template-columns: 1fr;
  }

  .portfolio-sidebar {
    position: static;
  }

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

  .material-card {
    grid-template-columns: auto 1fr;
  }

  .material-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: block;
  }

  .header-inner {
    position: relative;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--panel);
    padding: 1rem;
    box-shadow: var(--shadow-hover);
    border-bottom: 2px solid var(--border);
    z-index: 10;
  }

  .main-nav.open {
    display: block;
  }

  .main-nav ul {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  body::before {
    background-attachment: scroll;
  }

  .page-header .container {
    padding: 1.25rem 1rem;
  }

  .page-header {
    padding: 1.5rem 0;
  }

  .section {
    padding: 2.5rem 0;
  }

  .material-card {
    padding: 1rem;
    gap: 0.75rem;
  }

  .materials-toolbar {
    padding: 1rem;
  }

  .logo-text small {
    font-size: 0.65rem;
  }
}
