/* terryayyad.com — website presentation layer.
   The CV markup and its print styles stay as written; this file restyles it for screens:
   one continuous page instead of paper sheets, light serif display type, hairline rules,
   a sticky header with section tracking, and single-column layouts on phones. */

@media screen {
  :root {
    --bg: #FBFCFB;
    --surface: #F2F5F4;
    --ink: #1C3236;        /* names, headings */
    --text: #3A4646;       /* running text */
    --muted: #6B7573;      /* dates, places, captions */
    --accent: #2E6A6D;     /* links, section labels */
    --bronze: #8A6A43;     /* sidebar labels */
    --rule: #E1E7E5;       /* hairlines */
    --rule-strong: #C7D2CF;
    --serif: "Source Serif 4", NotoSerif, Georgia, serif;
    --sans: "Public Sans", Carlito, Calibri, Arial, sans-serif;
    --wrap: 1120px;
    --gutter: clamp(20px, 4vw, 48px);
    --header-h: 61px;
    font-family: var(--sans);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }
  html { scroll-behavior: smooth; }
  body { background: var(--bg); }
  ::selection { background: #D5E5E3; color: var(--ink); }
  a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: rgba(46, 106, 109, .35); transition: color .2s, text-decoration-color .2s; }
  a:hover { text-decoration-color: currentColor; }
  button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

  /* ---------- Header ---------- */
  .toolbar {
    position: sticky; top: 0; z-index: 20;
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 28px;
    min-height: var(--header-h); padding: 10px max(var(--gutter), calc((100vw - var(--wrap)) / 2));
    background: rgba(251, 252, 251, .86); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--rule); font-size: 13.5px;
  }
  .toolbar .brand { font-family: var(--serif); font-size: 19px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
  .toolbar nav { justify-content: center; gap: 4px 22px; }
  .toolbar nav a { position: relative; padding: 6px 0; color: var(--muted); white-space: nowrap; transition: color .2s; }
  .toolbar nav a::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 1px; height: 1px; background: currentColor;
    transform: scaleX(0); transition: transform .35s cubic-bezier(.2, .7, .2, 1);
  }
  .toolbar nav a:hover, .toolbar nav a.is-active { color: var(--ink); }
  .toolbar nav a.is-active::after { transform: scaleX(1); }
  .downloads { gap: 8px; }
  .downloads a {
    padding: 5px 13px 6px; border: 1px solid var(--rule-strong); border-radius: 999px;
    color: var(--ink); font-size: 13px; line-height: 1.2; white-space: nowrap;
    transition: background-color .2s, border-color .2s, color .2s;
  }
  .downloads a:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

  /* ---------- Sections: one page, not paper sheets ---------- */
  main { counter-reset: none; }
  .sheet {
    max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(64px, 8vw, 112px) var(--gutter);
    background: none; box-shadow: none; border-top: 1px solid var(--rule); scroll-margin-top: calc(var(--header-h) - 1px);
  }
  .sheet:first-child { border-top: 0; padding-top: clamp(56px, 9vw, 128px); }
  .sheet > footer { display: none; }

  /* section label: the running heading's subject becomes an eyebrow with a hairline */
  .running-heading { display: flex; align-items: center; gap: 18px; padding: 0; margin: 0 0 clamp(32px, 4.5vw, 56px); }
  .running-heading > div:first-child { display: none; }
  .running-heading .meta { margin: 0; text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
  .running-heading::after { content: ""; flex: 1 1 24px; height: 1px; background: var(--rule); }

  /* ---------- Opening ---------- */
  .opening-header { margin: 0 0 clamp(48px, 6vw, 80px); }
  .identity { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: clamp(24px, 4vw, 64px); margin: 0 0 clamp(32px, 4vw, 48px); }
  .identity h1 {
    margin: 0 0 18px; font-family: var(--serif); font-size: clamp(46px, 6.6vw, 92px); font-weight: 300;
    line-height: .98; letter-spacing: -0.03em; color: var(--ink);
  }
  .identity .copy { margin: 0 0 8px; font-size: clamp(17px, 1.5vw, 20px); font-weight: 400; letter-spacing: -0.005em; color: var(--accent); }
  .identity .meta { margin: 0; font-size: 13.5px; color: var(--muted); }
  .sheet .identity figure { max-width: clamp(104px, 11vw, 148px) !important; margin: 0 !important; padding: 5px; border: 1px solid var(--rule-strong); border-radius: 6px; background: #fff; }
  .identity .image-button img { border-radius: 3px; }
  .executive-summary {
    max-width: 41em; padding: 26px 0 0; margin: 0; background: none; border-top: 1px solid var(--rule-strong);
    font-family: var(--serif); font-size: clamp(19px, 1.75vw, 23px); font-weight: 300; line-height: 1.55; letter-spacing: -0.005em; color: var(--ink);
  }

  /* ---------- Type ---------- */
  .copy { font-size: 15.5px; line-height: 1.65; color: var(--text); margin: 0 0 12px; }
  .meta { font-size: 13px; line-height: 1.55; color: var(--muted); margin: 0 0 8px; }
  strong { font-weight: 600; color: var(--ink); }
  .entry-title { margin: 26px 0 4px; font-weight: 600; color: var(--ink); }
  .copy.entry-title { font-size: 16px; line-height: 1.4; }
  .entry-title:first-child { margin-top: 0; }
  .bullet { padding-left: 16px; text-indent: -12px; margin-bottom: 10px; }

  .sheet h3 {
    margin: clamp(44px, 5vw, 64px) 0 18px; padding: 0; background: none !important; color: var(--ink) !important;
    font-family: var(--serif); font-size: clamp(23px, 2.1vw, 29px); font-weight: 350; line-height: 1.2; letter-spacing: -0.015em;
  }
  .sheet h3:first-child { margin-top: 0; }
  .sheet > h3 + .meta { font-size: 14px; margin-bottom: clamp(24px, 3vw, 36px); }
  .project-title { margin: 0 0 6px; font-family: var(--serif); font-size: 22px; font-weight: 350; line-height: 1.25; letter-spacing: -0.01em; color: var(--ink); }

  /* ---------- Two-column pages ---------- */
  .columns { grid-template-columns: minmax(200px, 23%) minmax(0, 1fr); gap: clamp(36px, 5.5vw, 80px); }
  .sheet aside h3 {
    margin: 36px 0 14px; padding-top: 14px; border-top: 1px solid var(--rule);
    font-family: var(--sans); font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; line-height: 1.3;
    color: var(--bronze) !important;
  }
  .sheet aside h3:first-child { margin-top: 0; }
  aside .entry-title { margin-top: 16px; font-size: 13.5px; }
  aside .meta { font-size: 12.5px; }
  aside .copy { font-size: 13.5px; }

  /* ---------- Organisations, projects and images ---------- */
  .organization-heading { gap: 16px; margin: 26px 0 4px; }
  .organization-heading .entry-title { margin-top: 0; }

  .media-row { gap: clamp(20px, 3vw, 36px); }
  .project-entry { grid-template-columns: 168px minmax(0, 1fr); gap: clamp(20px, 3vw, 36px); margin: 0; padding: 28px 0; border-top: 1px solid var(--rule); }
  .project-entry:last-of-type { border-bottom: 1px solid var(--rule); }
  .sheet .project-entry figure { max-width: 100% !important; }
  .project-entry .organization-heading { margin-top: 0; }

  figure { margin: 4px 0 8px; }
  .image-button { border-radius: 4px; overflow: hidden; transition: opacity .2s; }
  .image-button:hover { opacity: .92; }
  .image-button img { border-radius: 4px; }
  .zoom-hint {
    right: 6px; bottom: 6px; width: 22px; height: 22px; font-size: 12px;
    background: rgba(255, 255, 255, .92); color: var(--ink); box-shadow: 0 0 0 1px rgba(28, 50, 54, .08);
    transition: opacity .2s;
  }
  @media (hover: hover) {
    .zoom-hint { opacity: 0; }
    .image-button:hover .zoom-hint, .image-button:focus-visible .zoom-hint { opacity: 1; }
  }

  /* ---------- ENR archive ---------- */
  .enr-archive { margin: clamp(44px, 5vw, 64px) 0 0; padding-top: 28px; border-top: 1px solid var(--rule); }
  .enr-archive summary {
    display: inline-flex; align-items: center; gap: 10px; list-style: none;
    padding: 8px 16px 9px; border: 1px solid var(--rule-strong); border-radius: 999px;
    font-size: 14px; color: var(--ink); transition: background-color .2s, color .2s, border-color .2s;
  }
  .enr-archive summary::-webkit-details-marker { display: none; }
  .enr-archive summary::after { content: "+"; font-size: 16px; line-height: 1; color: var(--muted); }
  .enr-archive[open] summary::after { content: "\2212"; }
  .enr-archive summary:hover { border-color: var(--ink); }
  .enr-grid { gap: clamp(24px, 4vw, 48px); margin-top: 28px; }
  .sheet .enr-grid h3 { margin: 0 0 12px; font-size: 19px; }

  /* ---------- Footer note ---------- */
  .help {
    max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 28px var(--gutter) 48px;
    display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap;
    border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--muted);
  }
  .help p { margin: 0; }

  /* ---------- Image viewer ---------- */
  dialog { border-radius: 12px; color: var(--text); box-shadow: 0 30px 90px rgba(12, 26, 28, .35); }
  dialog::backdrop { background: rgba(20, 34, 36, .62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
  .viewer-bar { border-bottom-color: var(--rule); }
  .viewer-title { font-family: var(--serif); font-weight: 400; color: var(--ink); }
  .asset-badge { color: var(--muted); }
  .viewer-actions button, .close-button {
    border: 1px solid var(--rule-strong); border-radius: 999px; background: transparent; color: var(--ink);
    padding: 6px 14px; font-size: 13px; transition: background-color .2s, color .2s, border-color .2s;
  }
  .viewer-actions button:hover { border-color: var(--ink); }
  .viewer-actions button[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: #fff; }
  .close-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; font-size: 18px; line-height: 1; }
  .viewer-canvas { background: var(--surface); }
  .viewer-foot { color: var(--text); }
  input[type=range] { accent-color: var(--accent); }

  /* ---------- Tablet: header on two rows ---------- */
  @media (max-width: 1080px) {
    :root { --header-h: 98px; }
    .toolbar { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; padding-block: 10px 0; }
    .toolbar nav {
      grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; flex-wrap: nowrap; gap: 22px;
      overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding: 2px var(--gutter) 8px;
      -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent 100%);
      mask-image: linear-gradient(to right, transparent 0, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent 100%);
    }
    .toolbar nav::-webkit-scrollbar { display: none; }
  }

  /* ---------- Phones ---------- */
  @media (max-width: 760px) {
    .toolbar { position: sticky; align-items: center; flex-wrap: nowrap; }
    .toolbar .brand { font-size: 18px; }
    .downloads a { padding: 4px 11px 5px; font-size: 12.5px; }
    .sheet { margin: 0; padding: 56px var(--gutter); }
    .sheet:first-child { padding-top: 40px; }

    .identity { grid-template-columns: 1fr; gap: 22px; }
    .identity > div:last-child { order: -1; }
    .sheet .identity figure { max-width: 92px !important; }
    .identity h1 { font-size: clamp(40px, 12vw, 54px); margin-bottom: 14px; }
    .identity .copy { font-size: 17px; }
    .identity .meta { font-size: 13px; }
    .executive-summary { font-size: 18.5px; padding-top: 22px; }

    .columns { grid-template-columns: 1fr; gap: 48px; }
    .columns aside { columns: 2; column-gap: 28px; }
    .sheet aside h3 { margin-top: 28px; }
    .running-heading { margin-bottom: 32px; }
    .running-heading .meta { font-size: 11px; }

    .organization-heading { grid-template-columns: minmax(0, 1fr) auto !important; gap: 14px; }
    .organization-logo { width: auto !important; max-width: 64px; }

    .project-entry { grid-template-columns: 1fr; gap: 16px; padding: 24px 0; }
    .project-entry > div:first-child { display: grid; grid-template-columns: 116px minmax(0, 1fr); align-items: end; gap: 14px; }
    .project-entry > div:first-child figure { margin: 0; }
    .project-entry > div:first-child .meta { margin: 0; }
    .project-title { font-size: 20px; }

    .copy { font-size: 15.5px; }
    .media-row figure { max-width: 100% !important; }
    .help { flex-direction: column; padding-bottom: 40px; }
    dialog { border-radius: 10px; }
  }
  @media (max-width: 560px) {
    .columns aside { columns: 1; }
  }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .toolbar nav a::after, .zoom-hint { transition: none; }
  }
}
