/* ==========================================================================
   Danylo Ohurtsov — personal site
   Single shared stylesheet. Plain CSS, no build step.

   Contents
     1. Design tokens (variables)
     2. Reset & base
     3. Typography
     4. Layout helpers
     5. Header & navigation
     6. Footer
     7. Buttons & links
     8. Home / hero
     9. About (portrait + skills)
    10. Experience (roles, education, résumé)
    11. Contact (details + form)
    12. Motion
    13. Responsive
   ========================================================================== */

/* 1. Design tokens ------------------------------------------------------- */
:root {
  /* Palette — warm grey bg, deep ink text, one muted forest-green accent */
  --bg:        #f4f1ea;  /* warm grey background */
  --surface:   #faf8f3;  /* slightly lifted cards / form fields */
  --ink:       #23211d;  /* deep warm ink — body & headings */
  --muted:     #6b675f;  /* secondary text, meta lines */
  --accent:    #3d5a45;  /* muted forest green — links, rules, active nav */
  --accent-dk: #2c4433;  /* hover / active accent */
  --rule:      #ded9cf;  /* hairline dividers */
  --focus:     #3d5a45;  /* focus ring */

  /* Type families */
  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans:  "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  /* Type scale (restrained perfect-fourth-ish) */
  --step-0: 1.0625rem;  /* body */
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: 1.85rem;
  --step-4: 2.3rem;
  --step-5: 3rem;

  /* Rhythm & shape */
  --measure: 42rem;         /* comfortable reading width */
  --container: 48rem;       /* ~760px content column */
  --space: 1.5rem;
  --radius: 4px;
}

/* 2. Reset & base -------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* sticky footer */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* 3. Typography ---------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.4rem, 6vw, var(--step-5)); font-weight: 700; }
h2 { font-size: clamp(1.7rem, 4vw, var(--step-4)); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { margin: 0 0 1.1em; max-width: var(--measure); }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
a:hover { color: var(--accent-dk); text-decoration-color: currentColor; }

strong { font-weight: 700; }

.lead {
  font-size: var(--step-1);
  line-height: 1.6;
  color: var(--ink);
}

.eyebrow {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.9rem;
}

.muted { color: var(--muted); }

/* 4. Layout helpers ------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

main {
  flex: 1 0 auto;
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}

section + section { margin-top: clamp(2.5rem, 6vw, 4rem); }

.divider {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: clamp(2.5rem, 6vw, 4rem) 0;
}

/* Accessible skip link */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 1rem; color: var(--bg); }

/* Visible keyboard focus for every interactive element */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

/* 5. Header & navigation ------------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background-color: var(--bg);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.25rem;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-serif);
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--ink); }

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.98rem;
  padding-bottom: 3px;
  border-bottom: 1.5px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--rule); }
.site-nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

/* 6. Footer -------------------------------------------------------------- */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.75rem;
  flex-wrap: wrap;
}
.footer-inner p { margin: 0; }
.footer-links {
  list-style: none;
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
}
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

/* 7. Buttons & links ----------------------------------------------------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}
.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid var(--accent);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-primary { background-color: var(--accent); color: var(--surface); }
.btn-primary:hover { background-color: var(--accent-dk); border-color: var(--accent-dk); color: var(--surface); }
.btn-ghost { background-color: transparent; color: var(--accent); }
.btn-ghost:hover { background-color: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--accent-dk); }

/* 8. Home / hero --------------------------------------------------------- */
.hero { padding-block: clamp(1rem, 4vw, 2.5rem); }
.hero h1 { margin-bottom: 0.35em; max-width: 16ch; }
.hero .tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.2rem, 3vw, var(--step-2));
  color: var(--accent);
  font-weight: 500;
  margin: 0 0 1.5rem;
  max-width: 34ch;
}
.hero .intro { max-width: var(--measure); }

/* 9. About — portrait + skills ------------------------------------------ */
.about-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}
.portrait {
  margin: 0;
}
.portrait img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface);
}
.portrait figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.6rem;
}

.skill-group { margin-bottom: 1.75rem; }
.skill-group h3 {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
}
.tags li {
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.4rem 0.85rem;
  font-size: 0.95rem;
}

/* 10. Experience --------------------------------------------------------- */
.role { padding-block: 1.75rem; border-top: 1px solid var(--rule); }
.role:first-of-type { border-top: 0; padding-top: 0.5rem; }
.role h3 { margin-bottom: 0.25rem; }
.role .meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1rem;
}
.role .meta .sep { color: var(--rule); padding: 0 0.4rem; }
.role ul {
  margin: 0;
  padding-left: 1.1rem;
  max-width: var(--measure);
}
.role li { margin-bottom: 0.55rem; padding-left: 0.25rem; }
.role li::marker { color: var(--accent); }

.edu-list { list-style: none; margin: 0; padding: 0; max-width: var(--measure); }
.edu-list li {
  padding: 0.9rem 0;
  border-top: 1px solid var(--rule);
}
.edu-list li:first-child { border-top: 0; }
.edu-list .school { color: var(--muted); }
.cred-title {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.cred-title:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.resume-cta { margin-top: 1.5rem; }
.resume-note {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

/* 11. Contact — details + form ------------------------------------------ */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}
.contact-details { list-style: none; margin: 0; padding: 0; }
.contact-details li { padding: 0.85rem 0; border-top: 1px solid var(--rule); }
.contact-details li:first-child { border-top: 0; }
.contact-details .label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.contact-details a { word-break: break-word; }

.contact-form .field { margin-bottom: 1.25rem; }
.contact-form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  transition: border-color 0.2s ease;
}
.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--accent); }
.contact-form textarea { resize: vertical; min-height: 8rem; }

/* 12. Motion — quiet fade-in on load, gentle transitions ----------------- */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
main { animation: fade-in-up 0.6s ease both; }

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

/* 13. Responsive --------------------------------------------------------- */
@media (max-width: 640px) {
  .about-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 240px; }
  .contact-grid { grid-template-columns: 1fr; }
  .header-inner { gap: 0.75rem; }
  .role .meta .sep { display: none; }
  .role .meta span { display: block; }
}
