/* ============================================
   CV Static Site Styles
   Converted from Next.js + Tailwind to Semantic CSS
   ============================================ */

/* ============================================
   Font Face Declarations
   Single variable font (weights 400–700), kept in sync with matija.eu
   so both sites render identically.
   ============================================ */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-next.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
  /* Colors - Light Mode */
  --background: hsl(0, 0%, 100%);
  --foreground: hsl(0, 0%, 0%);
  --border: hsl(214.3, 31.8%, 91.4%);
  --radius: 0.5rem;

  /* Text opacity variants */
  --text-muted-1: hsl(0, 0%, 0%, 0.6);
  --text-muted-2: hsl(0, 0%, 0%, 0.7);
  --text-muted-3: hsl(0, 0%, 0%, 0.8);
  --text-primary: hsl(0, 0%, 0%, 0.9);
  --text-separator: hsl(0, 0%, 0%, 0.25);

  /* Highlight colors */
  --highlight-emerald: rgba(209, 250, 229, 0.85);

  /* Emerald accent colors */
  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-200: #a7f3d0;
  --emerald-700: #047857;
  --emerald-800: #065f46;

  /* Slate colors */
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* Type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-display: 1.375rem;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --background: hsl(0, 0%, 6%);
    --foreground: hsl(0, 0%, 95%);
    --border: hsl(217, 20%, 20%);

    /* Text opacity variants */
    --text-muted-1: hsl(0, 0%, 95%, 0.6);
    --text-muted-2: hsl(0, 0%, 95%, 0.7);
    --text-muted-3: hsl(0, 0%, 95%, 0.8);
    --text-primary: hsl(0, 0%, 95%, 0.9);
    --text-separator: hsl(0, 0%, 95%, 0.25);

    /* Highlight colors - darker emerald for dark mode */
    --highlight-emerald: rgba(4, 120, 87, 0.4);

    /* Emerald accent colors - adjusted for dark mode */
    --emerald-50: #064e3b;
    --emerald-100: #065f46;
    --emerald-200: #047857;
    --emerald-700: #34d399;
    --emerald-800: #6ee7b7;

    /* Slate colors - adjusted for dark mode */
    --slate-400: #64748b;
    --slate-500: #94a3b8;
    --slate-700: #cbd5e1;
    --slate-800: #e2e8f0;
    --slate-900: #f1f5f9;
    --slate-950: #f8fafc;
  }
}

/* ============================================
   Base Styles & Typography
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-color: var(--border);
}

html {
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Atkinson Hyperlegible Next", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 400;
  background: var(--background);
  color: var(--foreground);
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: -0.006em;
  /* Advanced OpenType features */
  font-feature-settings:
    "kern" 1,
    "liga" 1,
    "calt" 1;
  font-variant-ligatures: common-ligatures contextual;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color-scheme: light dark;
}

/* Heading hierarchy */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h2 {
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Paragraph refinements */
p {
  text-wrap: pretty;
  hanging-punctuation: first last;
  line-height: 1.6;
}

/* Link styles */
a {
  color: var(--slate-700);
  text-decoration: none;
  transition: color 200ms ease;
  font-feature-settings:
    "kern" 1,
    "liga" 1;
}

a:hover {
  color: var(--slate-950);
}

/* Keyboard focus visibility */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--background),
    0 0 0 4px var(--slate-500);
  border-radius: 0.25rem;
}

/* List styles */
ul {
  list-style: none;
}

/* Address styles */
address {
  font-style: normal;
}

/* ============================================
   Site Header / Navigation
   Mirrors the navbar on matija.eu (Astro/Tailwind)
   so cv.matija.eu presents an identical primary nav.
   ============================================ */
.site-header {
  border-bottom: 1px solid hsl(214.3, 31.8%, 91.4%); /* slate-200 */
  background: hsla(0, 0%, 100%, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@media (prefers-color-scheme: dark) {
  .site-header {
    border-bottom-color: hsl(217, 20%, 20%);
    background: hsla(0, 0%, 6%, 0.8);
  }
}

.site-header__container {
  width: 100%;
  margin-inline: auto;
  padding: 1.5rem 1.25rem; /* py-6 px-5 */
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Mirror matija.eu's custom Tailwind container breakpoints */
@media (min-width: 600px) {
  .site-header__container {
    max-width: 600px;
  }
}
@media (min-width: 728px) {
  .site-header__container {
    max-width: 728px;
  }
}
@media (min-width: 960px) {
  .site-header__container {
    max-width: 960px;
  }
}
@media (min-width: 1040px) {
  .site-header__container {
    max-width: 1040px;
  }
}

/*
 * Type sizes below mirror matija.eu's Tailwind `fontSize` tokens:
 *   text-sm:   0.875rem / line-height 1.5 / letter-spacing  0em
 *   text-base: 1rem     / line-height 1.6 / letter-spacing -0.011em
 *   text-lg:   1.125rem / line-height 1.6 / letter-spacing -0.014em
 * Each utility carries its own tracking, so we set it explicitly here
 * (otherwise the nav inherits the body's -0.006em and the glyphs look
 * slightly too tight/loose compared with matija.eu).
 */
.site-header__wordmark {
  font-size: var(--text-base);
  line-height: 1.6;
  letter-spacing: -0.011em;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  transition: color 200ms ease;
}

@media (min-width: 728px) {
  .site-header__wordmark {
    font-size: var(--text-lg);
    letter-spacing: -0.014em;
  }
}

.site-header__links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  letter-spacing: 0em;
  font-weight: 500;
  color: var(--slate-700);
}

@media (min-width: 600px) {
  .site-header__links {
    gap: 1.25rem;
  }
}

@media (min-width: 728px) {
  .site-header__links {
    gap: 1.5rem;
    font-size: var(--text-base);
    line-height: 1.6;
    letter-spacing: -0.011em;
  }
}

.site-header__link {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  transition: color 200ms ease;
}

.site-header__link:hover {
  color: var(--slate-950);
}

@media (prefers-color-scheme: dark) {
  .site-header__link:hover {
    color: #ffffff; /* paper-text-white */
  }
}

/*
 * Highlighted "Tools" pill — mirrors matija.eu's Tailwind classes:
 *   -my-0.5 inline-flex items-center gap-1.5 rounded-full
 *   bg-yellow-200/80 px-2.5 py-0.5 ring-1 ring-yellow-300/70
 *   hover:bg-yellow-200
 *   dark:bg-yellow-300/20 dark:ring-yellow-300/40 dark:hover:bg-yellow-300/30
 *
 * Tailwind's `ring-*` uses an OUTSET box-shadow (not inset), so the
 * 1px ring sits just outside the pill's rounded edge rather than eating
 * into the yellow fill.
 */
.site-header__link--highlight {
  position: relative;
  margin-block: -0.125rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 9999px;
  background-color: rgba(254, 240, 138, 0.8); /* yellow-200/80 */
  padding: 0.125rem 0.625rem; /* py-0.5 px-2.5 */
  box-shadow: 0 0 0 1px rgba(253, 224, 71, 0.7); /* ring-1 ring-yellow-300/70 */
}

.site-header__link--highlight:hover {
  background-color: rgb(254, 240, 138); /* yellow-200 */
}

@media (prefers-color-scheme: dark) {
  .site-header__link--highlight {
    background-color: rgba(253, 224, 71, 0.2); /* yellow-300/20 */
    box-shadow: 0 0 0 1px rgba(253, 224, 71, 0.4); /* ring-yellow-300/40 */
  }

  .site-header__link--highlight:hover {
    background-color: rgba(253, 224, 71, 0.3); /* yellow-300/30 */
  }
}

.site-header__pulse {
  position: relative;
  display: inline-flex;
  height: 0.5rem;
  width: 0.5rem;
}

.site-header__pulse-ping {
  position: absolute;
  inset: 0;
  display: inline-flex;
  height: 100%;
  width: 100%;
  border-radius: 9999px;
  background-color: #34d399; /* emerald-400 */
  opacity: 0.75;
  animation: site-header-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.site-header__pulse-dot {
  position: relative;
  display: inline-flex;
  height: 0.5rem;
  width: 0.5rem;
  border-radius: 9999px;
  background-color: #10b981; /* emerald-500 */
}

@keyframes site-header-ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Screen-reader-only helper (Tailwind's .sr-only) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   Layout Components
   ============================================ */
.cv-container {
  position: relative;
  margin: 0 auto;
  min-height: 100vh;
  padding: 1rem;
  overflow: auto;
}

@media (min-width: 768px) {
  .cv-container {
    padding: 4rem;
  }
}

.cv-content {
  margin: 0 auto;
  width: 100%;
  max-width: 42rem;
  padding: 1.5rem;
}

@media (min-width: 768px) {
  .cv-content {
    padding: 2rem;
  }
}

/* ============================================
   Header Components
   ============================================ */
.cv-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.header-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.heading-display {
  font-size: var(--text-display);
  letter-spacing: -0.02em;
  font-weight: 700;
  text-wrap: balance;
  line-height: 1.1;
}

.pronunciation {
  font-size: var(--text-sm);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.025em;
  color: var(--text-muted-1);
}

.location {
  max-width: 28rem;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--text-muted-2);
}

.location-inner {
  display: inline-flex;
  gap: 0.5rem;
  align-items: baseline;
  line-height: 1.375;
}

/* Contact Links (Screen Only) */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.25rem;
  padding-top: 0.25rem;
  font-size: var(--text-sm);
  color: var(--text-muted-2);
}

.contact-link {
  display: inline-flex;
  border-radius: 0.25rem;
  padding: 0.125rem 0.125rem;
  color: var(--slate-700);
  transition: color 200ms ease;
}

.contact-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.contact-link--highlight {
  position: relative;
  background-image: linear-gradient(
    var(--highlight-emerald),
    var(--highlight-emerald)
  );
  background-position: 0 100%;
  background-size: 100% 40%;
  background-repeat: no-repeat;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.contact-separator {
  color: var(--text-separator);
}

/* Print Contact */
.print-contact {
  display: none;
  gap: 0.5rem;
  color: var(--text-muted-3);
}

.print-contact a {
  text-decoration: underline;
}

/* Avatar */
.avatar-wrapper {
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .avatar-wrapper {
    display: flex;
  }
}

.cv-avatar {
  width: 7rem;
  height: 7rem;
  border-radius: 9999px;
  object-fit: cover;
}

/* ============================================
   Section Components
   ============================================ */
.cv-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.heading-section {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.section-content {
  color: var(--text-primary);
}

/* Body text styling */
.body-text {
  font-size: var(--text-base);
  line-height: 1.7;
  letter-spacing: -0.014em;
  text-wrap: pretty;
  max-width: 80ch;
}

/* ============================================
   Skills Components
   ============================================ */
.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0;
  list-style: none;
}

.skill-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid var(--emerald-200);
  background: var(--emerald-50);
  padding: 0.125rem 0.5rem;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.025em;
  color: var(--emerald-700);
  white-space: nowrap;
}

/* ============================================
   Work Experience Components
   ============================================ */
.work-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.work-item {
  border-radius: var(--radius);
  background: var(--background);
  padding: 0.25rem 0;
  page-break-inside: avoid;
  break-inside: avoid;
}

.work-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-bottom: 0.25rem;
}

.work-title {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  line-height: 1.5;
  letter-spacing: -0.014em;
  flex-wrap: wrap;
}

.company-link {
  color: var(--slate-700);
  transition: color 200ms ease;
}

.company-link:hover {
  color: var(--slate-950);
}

.work-period {
  font-variant: small-caps;
  letter-spacing: 0.03em;
  font-weight: 400;
  font-feature-settings:
    "smcp" 1,
    "c2sc" 1,
    "kern" 1;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: var(--text-sm);
  color: var(--text-muted-2);
}

.work-content {
  margin-top: 0.5rem;
  font-size: var(--text-base);
  line-height: 1.7;
  letter-spacing: -0.011em;
  color: var(--text-primary);
  text-wrap: pretty;
}

.work-content p {
  margin: 0;
}

/* ============================================
   Accent Underline Utility
   ============================================ */
.accent-underline {
  position: relative;
  display: inline;
  background-image: linear-gradient(
    var(--highlight-emerald),
    var(--highlight-emerald)
  );
  background-position: 0 100%;
  background-size: 100% 40%;
  background-repeat: no-repeat;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.accent-underline--emerald {
  background-image: linear-gradient(
    var(--highlight-emerald),
    var(--highlight-emerald)
  );
}

/* ============================================
   Site Footer
   ============================================ */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2.5rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .site-footer {
    padding: 1rem 6rem;
  }
}

.site-footer__copy {
  font-size: var(--text-sm);
  color: var(--slate-500);
}

.site-footer__back {
  font-size: var(--text-sm);
  color: var(--slate-500);
  text-decoration: none;
  transition: color 200ms ease;
}

.site-footer__back:hover {
  color: var(--slate-700);
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
  @page {
    size: A4;
    margin: 1.5cm 1cm;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: white !important;
    color: black !important;
    font-size: 10pt;
    line-height: 1.4;
    font-feature-settings:
      "kern" 1,
      "liga" 1,
      "tnum" 1;
  }

  h1 {
    font-size: 11pt;
    margin-bottom: 4pt;
    letter-spacing: -0.02em;
    font-weight: 700;
  }

  h2 {
    font-size: 11pt;
    margin-bottom: 3pt;
    letter-spacing: -0.01em;
    font-weight: 700;
  }

  h3 {
    font-size: 11pt;
    margin-bottom: 2pt;
    letter-spacing: -0.005em;
    font-weight: 700;
  }

  /* Prevent page breaks inside important elements */
  article,
  .work-item {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  header {
    page-break-inside: avoid;
    break-inside: avoid;
    page-break-after: avoid;
    break-after: avoid;
  }

  section {
    page-break-inside: auto;
    break-inside: auto;
  }

  h2 {
    page-break-after: avoid;
    break-after: avoid;
    orphans: 3;
  }

  /* Prevent orphans and widows */
  p,
  li {
    orphans: 3;
    widows: 3;
  }

  /* Keep headings with content */
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    page-break-after: avoid;
    break-after: avoid;
  }

  /* Don't show URLs for links */
  a::after {
    content: none !important;
  }

  /* Hide nav, footer, and contact links, show print contact */
  .site-header {
    display: none !important;
  }

  .site-footer {
    display: none !important;
  }

  .contact-links {
    display: none !important;
  }

  .print-contact {
    display: flex !important;
    font-size: 9pt;
  }

  /* Hide avatar on print */
  .avatar-wrapper {
    display: none !important;
  }

  /* Optimize spacing for print */
  .cv-container {
    padding: 0 !important;
  }

  .cv-content {
    padding: 0 !important;
    max-width: 100% !important;
  }

  .cv-section {
    gap: 0.125rem;
  }

  .work-feed {
    gap: 0.25rem;
  }

  .work-item {
    padding: 0;
  }

  .work-header {
    gap: 0.125rem;
  }

  .work-title {
    font-size: 11pt;
  }

  .work-period {
    font-size: 9pt;
  }

  .work-content {
    margin-top: 0.125rem;
    font-size: 9pt;
    line-height: 1.4;
  }

  .body-text {
    font-size: 10pt;
    line-height: 1.4;
  }

  .skill-badge {
    font-size: 8pt;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
  }

  .skills-list {
    gap: 0.25rem;
  }

  /* Make sure avatar prints well if visible */
  img {
    max-width: 100%;
    page-break-inside: avoid;
  }
}
