/* ============================================
   Studio Alticcio — Styles
   A European cultural journal
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Colors */
  --cream: #FAF8F5;
  --paper: #F5F2ED;
  --ink: #1C1917;
  --ink-light: #44403C;
  --ink-faint: #78716C;
  --accent-gold: #B8860B;
  --accent-midnight: #1E3A5F;
  --sepia: #704214;
  --sepia-light: #8B7355;

  /* Typography */
  --font-display: 'Cormorant Garamond', 'Garamond', 'Georgia', serif;
  --font-body: 'Cardo', 'Georgia', serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;

  /* Sizing */
  --measure: 65ch;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 6rem;
  --space-2xl: 10rem;
}

/* --- Animations --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--cream);
  /* Subtle paper texture via gradient */
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(245, 242, 237, 0.8) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(245, 242, 237, 0.6) 0%, transparent 50%);
  font-variant-numeric: oldstyle-nums proportional-nums;
  font-feature-settings: "onum" 1, "pnum" 1, "kern" 1, "liga" 1;
}

::selection {
  background-color: var(--accent-gold);
  color: var(--cream);
}

/* --- Page Layout --- */
.page {
  max-width: calc(var(--measure) + var(--space-lg) * 2);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .page {
    padding: var(--space-2xl) var(--space-lg);
  }
}

/* --- Header --- */
.header {
  text-align: center;
  margin-bottom: var(--space-xl);
  animation: fadeIn 0.8s ease-out both;
}

.wordmark h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: var(--space-xs);
}

.tagline {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-style: italic;
  font-weight: 400;
  color: var(--ink-light);
  letter-spacing: 0.05em;
}

/* Fleuron ornament */
.fleuron {
  display: block;
  font-size: 0.6rem;
  color: var(--accent-gold);
  margin-bottom: var(--space-sm);
  animation: shimmer 3s ease-in-out infinite;
}

/* --- Main Content --- */
.main {
  flex: 1;
}

.section {
  margin-bottom: var(--space-xl);
  animation: fadeIn 0.6s ease-out both;
}

.section.about { animation-delay: 0.1s; }
.section.writing { animation-delay: 0.2s; }
.section.tools { animation-delay: 0.3s; }

/* --- Section Labels --- */
.section-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: var(--space-sm);
  font-variant: small-caps;
}

.subsection-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: var(--space-sm);
  margin-top: var(--space-lg);
}

.section-description {
  font-size: 1rem;
  color: var(--ink-light);
  margin-bottom: var(--space-sm);
  max-width: var(--measure);
}

/* --- About Section --- */
.about-text {
  max-width: var(--measure);
  margin-bottom: var(--space-sm);
  text-align: left;
  hyphens: auto;
}

.about-text:last-of-type {
  margin-bottom: var(--space-md);
}

.about-location {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-light);
  font-size: 0.95rem;
}

/* Drop Cap */
.dropcap {
  float: left;
  font-family: var(--font-display);
  font-size: 4.5rem;
  line-height: 0.8;
  font-weight: 500;
  color: var(--ink);
  padding-right: 0.15em;
  padding-top: 0.1em;
  /* Subtle gold accent on drop cap */
  background: linear-gradient(135deg, var(--ink) 60%, var(--sepia) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Divider --- */
.divider {
  border: none;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--sepia-light) 20%,
    var(--sepia-light) 80%,
    transparent
  );
  margin: var(--space-lg) 0;
  max-width: 20rem;
  margin-left: auto;
  margin-right: auto;
}

/* Decorative terminals on divider */
.divider::before,
.divider::after {
  content: '';
  display: block;
  width: 4px;
  height: 4px;
  background-color: var(--sepia-light);
  border-radius: 50%;
  position: relative;
}

/* --- Links --- */
a {
  color: var(--ink);
  text-decoration: none;
  position: relative;
  transition: color 0.2s ease-out;
}

a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--sepia-light);
  transform: scaleX(1);
  transform-origin: left;
  transition: transform 0.25s ease-out, background-color 0.2s ease-out;
}

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

a:hover::after,
a:focus::after {
  background-color: var(--accent-midnight);
  transform: scaleX(1);
  animation: underlineSlide 0.3s ease-out;
}

@keyframes underlineSlide {
  0% { transform: scaleX(0); transform-origin: left; }
  100% { transform: scaleX(1); transform-origin: left; }
}

.link-arrow {
  display: inline-block;
  position: relative;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  padding-left: 1.2em;
}

.link-arrow::before {
  content: '→';
  position: absolute;
  left: 0;
  transition: transform 0.25s ease-out;
}

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

.link-arrow:hover,
.link-arrow:focus {
  color: var(--accent-midnight);
}

.link-arrow:hover::before {
  transform: translateX(4px);
}

/* --- Essays --- */
.essays {
  margin-top: var(--space-md);
}

.essays-forthcoming {
  margin-top: var(--space-lg);
}

.essay {
  margin-bottom: var(--space-sm);
}

.essay-link {
  display: block;
  text-decoration: none;
  transition: transform 0.2s ease-out;
}

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

.essay-link:hover {
  transform: translateX(3px);
}

.essay-link:hover .essay-title {
  color: var(--accent-midnight);
}

.essay-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  font-style: italic;
  color: var(--ink);
  margin-bottom: 0.25rem;
  transition: color 0.2s ease-out;
}

.essay-description {
  font-size: 0.9rem;
  color: var(--ink-light);
  max-width: var(--measure);
}

.essay-list {
  list-style: none;
  padding: 0;
}

.essay-list li {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-style: italic;
  color: var(--ink-light);
  margin-bottom: 0.5rem;
  padding-left: 1.5em;
  position: relative;
  transition: color 0.2s ease-out, transform 0.2s ease-out;
}

.essay-list li:hover {
  color: var(--ink);
  transform: translateX(3px);
}

.essay-list li::before {
  content: '✦';
  position: absolute;
  left: 0.5em;
  color: var(--accent-gold);
  font-size: 0.5rem;
  top: 0.45em;
  opacity: 0.7;
}

/* --- Tools Section --- */
.tool {
  margin-bottom: var(--space-md);
  padding: var(--space-sm);
  padding-bottom: var(--space-md);
  margin-left: calc(-1 * var(--space-sm));
  margin-right: calc(-1 * var(--space-sm));
  border-bottom: 1px solid rgba(112, 66, 20, 0.15);
  border-radius: 4px;
  transition: background-color 0.2s ease-out, transform 0.2s ease-out;
}

.tool:hover {
  background-color: rgba(245, 242, 237, 0.6);
  transform: translateX(4px);
}

.tool:last-child {
  border-bottom: none;
  padding-bottom: var(--space-sm);
}

.tool-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.tool-description {
  font-size: 0.95rem;
  color: var(--ink-light);
  max-width: var(--measure);
  margin-bottom: 0.75rem;
}

.tool-status {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-faint);
  letter-spacing: 0.05em;
}

/* Abbreviations */
abbr {
  font-variant: small-caps;
  text-transform: lowercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  border-bottom: 1px dotted var(--sepia-light);
  cursor: help;
}

/* --- Footer --- */
.footer {
  margin-top: auto;
  padding-top: var(--space-lg);
  text-align: center;
  animation: fadeIn 0.6s ease-out 0.4s both;
}

.footer-links {
  margin-bottom: var(--space-sm);
}

.footer-links a {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

.footer-separator {
  display: inline-block;
  color: var(--accent-gold);
  margin: 0 var(--space-sm);
  font-size: 0.5rem;
  vertical-align: middle;
  opacity: 0.7;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.footer-links:hover .footer-separator {
  animation: shimmer 1.5s ease-in-out infinite;
}

.copyright {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
}

/* --- Emphasis --- */
em {
  font-style: italic;
}

strong {
  font-weight: 700;
}

/* --- Responsive Adjustments --- */
@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  .wordmark h1 {
    letter-spacing: 0.15em;
  }

  .dropcap {
    font-size: 3.5rem;
  }

  .page {
    padding: var(--space-lg) var(--space-sm);
  }

  .divider {
    max-width: 10rem;
  }
}

/* --- Print Styles --- */
@media print {
  body {
    background: white;
    color: black;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  a {
    text-decoration: none;
    color: black;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --cream: #FFFFFF;
    --paper: #FFFFFF;
    --ink: #000000;
    --ink-light: #333333;
    --ink-faint: #666666;
  }
}
