@view-transition {
  navigation: auto;
}

:root {
  color-scheme: dark;
  interpolate-size: allow-keywords;
  
  --bg: oklch(0.11 0.008 50);
  --bg-card: oklch(0.14 0.01 50 / 0.72);
  --bg-card-hover: oklch(0.17 0.012 50 / 0.85);
  --bg-input: oklch(0.16 0.009 50 / 0.9);
  --ink: oklch(0.96 0.01 85);
  --muted: oklch(0.72 0.016 75);
  --muted-light: oklch(0.84 0.014 80);
  --accent: oklch(0.48 0.17 25);
  --accent-bright: oklch(0.66 0.20 25);
  --accent-glow: oklch(0.55 0.18 25 / 0.35);
  --line: oklch(0.95 0.012 85 / 0.12);
  --line-strong: oklch(0.95 0.012 85 / 0.26);
  --focus-ring: oklch(0.72 0.18 25);
}

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: #0c0b0a;
  background-color: var(--bg);
  color: #f2eee3;
  color: var(--ink);
  min-height: 100vh;
  scrollbar-color: var(--accent) rgba(12, 11, 10, 0.4);
  scrollbar-width: thin;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background-image:
    linear-gradient(180deg, rgba(12,11,10,0.2) 0%, rgba(12,11,10,0.65) 30%, rgba(12,11,10,0.92) 75%, rgba(12,11,10,0.98) 100%),
    linear-gradient(90deg, rgba(12,11,10,0.7) 0%, rgba(12,11,10,0.85) 50%, rgba(12,11,10,0.95) 100%),
    image-set(url('books_bg.webp') type('image/webp'), url('books_bg.jpg') type('image/jpeg'));
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 100dvh;
}

/* Typography modern enhancements */
h1, h2, h3 {
  text-wrap: balance;
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  font-weight: 400;
  margin: 0;
}

p {
  text-wrap: pretty;
  margin: 0;
}

/* Icons */
.icon {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.15em;
  stroke-width: 2;
  flex-shrink: 0;
}

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

/* Container */
.page-container {
  width: min(1020px, 94vw);
  margin: auto;
  padding: clamp(1.25rem, 3.5vh, 2.5rem) 0;
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2.5vh, 1.75rem);
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.avatar-wrap {
  flex: 0 0 62px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(240, 236, 223, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  view-transition-name: hero-avatar;
}

.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text h1 {
  font-size: clamp(1.75rem, 3.8vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
  view-transition-name: hero-title;
}

.mark {
  color: var(--accent-bright);
}

.tagline {
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  color: var(--muted-light);
  margin-top: 0.2rem;
  font-weight: 500;
}

/* Language Toggle */
.language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(15, 14, 13, 0.75);
  backdrop-filter: blur(10px);
}

.language-toggle a {
  color: var(--muted-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  min-height: 1.9rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease;
}

.language-toggle a:hover {
  color: var(--ink);
  background: rgba(232, 227, 214, 0.1);
}

.language-toggle a[aria-current="page"] {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* Main Grid Layout */
.grid-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(320px, 1.15fr);
  gap: clamp(1rem, 2.5vw, 1.75rem);
  align-items: stretch;
}

/* Glassmorphic Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(1.25rem, 2.8vw, 1.75rem);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
}

/* Left Card: Intro & Contact */
.intro-card {
  justify-content: space-between;
  gap: 1.25rem;
}

.bio-lead {
  font-size: clamp(1.02rem, 1.4vw, 1.15rem);
  line-height: 1.55;
  color: var(--ink);
  font-weight: 400;
}

.contact-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.direct-email {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  background: rgba(21, 19, 17, 0.7);
  border: 1px solid var(--line);
}

.email-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 160ms ease;
}

.email-link:hover {
  color: var(--accent-bright);
}

.copy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(232, 227, 214, 0.06);
  border: 1px solid var(--line);
  color: var(--muted-light);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-family: inherit;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.copy-pill:hover {
  color: var(--ink);
  background: rgba(232, 227, 214, 0.14);
  border-color: var(--line-strong);
}

/* Quick Form */
.quick-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  accent-color: var(--accent-bright);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

input, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.65rem 0.8rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.92rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

textarea {
  min-height: 4.8rem;
  resize: vertical;
}

input:hover, textarea:hover {
  border-color: var(--line-strong);
}

input:focus, textarea:focus {
  border-color: var(--accent-bright);
  background: rgba(17, 15, 14, 0.98);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

input:user-invalid, textarea:user-invalid {
  border-color: oklch(0.62 0.22 25);
  box-shadow: 0 0 0 2px oklch(0.62 0.22 25 / 0.2);
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: var(--accent);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.submit-btn:hover {
  background: var(--accent-bright);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

.form-status {
  font-size: 0.82rem;
  color: var(--muted-light);
  min-height: 1.2em;
}

/* Social links */
.socials {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(19, 18, 17, 0.6);
  text-decoration: none;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.socials a:hover {
  color: var(--ink);
  border-color: var(--accent-bright);
  background: var(--accent-glow);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.brand-icon {
  width: 1.05rem;
  height: 1.05rem;
  filter: invert(75%) sepia(10%) saturate(200%) hue-rotate(5deg) brightness(92%) contrast(88%);
}

.socials a:hover .brand-icon {
  filter: invert(95%) sepia(20%) saturate(150%) hue-rotate(0deg) brightness(100%) contrast(90%);
}

/* Right Card: Focus / Services */
.services-card {
  gap: 1.15rem;
}

.section-title {
  font-size: 1.35rem;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 2.8rem;
  height: 2px;
  background: var(--accent-bright);
}

.focus-grid {
  display: grid;
  gap: 0.85rem;
  flex: 1;
}

.focus-item {
  padding: 0.85rem 1rem;
  background: rgba(21, 19, 17, 0.5);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: background 200ms ease, border-color 200ms ease, transform 200ms ease;
}

.focus-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.focus-item h3 {
  font-size: 1.02rem;
  color: var(--ink);
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.focus-item p {
  font-size: 0.88rem;
  color: var(--muted-light);
  line-height: 1.45;
}

/* Footer */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  opacity: 0.85;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 780px) {
  body {
    background-attachment: scroll;
    background-image:
      linear-gradient(180deg, rgba(12,11,10,0.4) 0%, rgba(12,11,10,0.85) 30%, rgba(12,11,10,0.98) 100%),
      image-set(url('books_bg_mobile.webp') type('image/webp'), url('books_bg.jpg') type('image/jpeg'));
  }

  .page-container {
    padding: 1.25rem 0;
    gap: 1.15rem;
  }

  .site-header {
    position: relative;
    padding: 0 0.25rem;
  }

  .language-toggle {
    position: absolute;
    right: 0;
    top: 0;
  }

  .grid-layout {
    grid-template-columns: 1fr;
    gap: 1.15rem;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .submit-btn {
    width: 100%;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
