/* Fernando Kylas, contact card. Tokens follow mybrand.fernandokylas.com. */

@font-face {
  font-family: "Strawford";
  src: url("/assets/fonts/strawford-light-webfont.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Strawford";
  src: url("/assets/fonts/strawford-regular-webfont.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geomanist";
  src: url("/assets/fonts/geomanist-book-webfont.woff2") format("woff2");
  font-weight: 350 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geomanist";
  src: url("/assets/fonts/geomanist-medium-webfont.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-display: "Strawford", Georgia, "Times New Roman", serif;
  --font-text: "Geomanist", "Helvetica Neue", Arial, sans-serif;

  --surface: #f6f4f1;
  --surface-raised: #fcfcfb;
  --text-primary: #0a0a0a;
  --text-secondary: #4a4a4a;
  --text-tertiary: #616161;
  --border: #e4e3e8;
  --border-strong: #4a4a4a;
  --accent: #869f75;
  --ink: #0a0a0a;
  --on-primary: #f6f4f1;
  --surface-selected: #ebf0e9;
  --surface-hover: #e4e3e8;
  --text-tertiary-raised: #616161;
  --ground: url("/assets/img/ground-forest-light.webp");
  --shadow-soft: 0 12px 40px rgba(9, 9, 11, 0.05);
  --backdrop: rgba(9, 9, 9, 0.4);

  --radius-control: 4px;
  --radius-card: 6px;
  --dur-press: 120ms;
  --dur-open: 200ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light dark;
}

/* Dark tokens: the system setting applies unless a manual choice sets data-theme on <html>. */
:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #090909;
    --surface-raised: #2a2a2a;
    --text-primary: #fafaf7;
    --text-secondary: #adadad;
    --text-tertiary: #8e8e8e;
    --border: #2a2a2a;
    --border-strong: #adadad;
    --on-primary: #090909;
    --surface-selected: rgba(134, 159, 117, 0.14);
    --surface-hover: rgba(250, 250, 247, 0.08);
    --text-tertiary-raised: #adadad;
    --ground: url("/assets/img/ground-leaves-dark.webp");
    --shadow-soft: none;
    --backdrop: rgba(0, 0, 0, 0.6);
  }
}

/* Same values as the block above, for a manual dark choice. Keep the two in sync. */
:root[data-theme="dark"] {
  --surface: #090909;
  --surface-raised: #2a2a2a;
  --text-primary: #fafaf7;
  --text-secondary: #adadad;
  --text-tertiary: #8e8e8e;
  --border: #2a2a2a;
  --border-strong: #adadad;
  --on-primary: #090909;
  --surface-selected: rgba(134, 159, 117, 0.14);
  --surface-hover: rgba(250, 250, 247, 0.08);
  --text-tertiary-raised: #adadad;
  --ground: url("/assets/img/ground-leaves-dark.webp");
  --shadow-soft: none;
  --backdrop: rgba(0, 0, 0, 0.6);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-text);
  font-weight: 350;
  font-size: 1rem;
  line-height: 1.6;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

img,
svg {
  display: block;
}

::selection {
  background: var(--accent);
  color: #0a0a0a;
}

:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

/* Layout */

.page {
  width: 100%;
  max-width: 30rem;
  margin-inline: auto;
  padding:
    max(0.75rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(2rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3rem;
}

.logo {
  width: auto;
  height: 2.25rem;
  color: var(--text-primary);
}

.card {
  display: flex;
  flex-direction: column;
  margin-top: 0.75rem;
}

@media (min-width: 40rem) {
  .page {
    padding-top: 3rem;
    padding-bottom: 4rem;
  }

  .card {
    margin-top: 1.5rem;
    padding: 1.5rem 2rem 2rem;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    --text-tertiary: var(--text-tertiary-raised);
  }

  .card .ground {
    margin: -0.5rem -1rem 0;
  }
}

/* Identity */

.ground {
  aspect-ratio: 3 / 1;
  border-radius: var(--radius-card);
  background: var(--border) var(--ground) center / cover no-repeat;
}

/* Profile-style portrait: the full-ratio photo overlapping the ground's lower edge, ringed in the colour behind it.
   The hairline keeps the edge visible in dark, where the photo's black meets the page. */
.portrait {
  position: relative;
  width: 8.5rem;
  height: auto;
  aspect-ratio: 928 / 1120;
  margin: -3.5rem 0 0 1rem;
  border: 4px solid var(--ring, var(--surface));
  border-radius: var(--radius-card);
  box-shadow: 0 0 0 1px var(--border);
  background: #161616;
  object-fit: cover;
}

@media (min-width: 40rem) {
  .card {
    --ring: var(--surface-raised);
  }

  .portrait {
    width: 9.5rem;
    margin-top: -4rem;
  }
}

.name {
  margin-top: 1rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2.25rem;
  line-height: 1.167;
  letter-spacing: -0.016em;
  text-wrap: balance;
}

.role {
  margin-top: 0.25rem;
  font-weight: 500;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.lede {
  margin-top: 1.25rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.375rem;
  line-height: 1.545;
  letter-spacing: -0.004em;
  color: var(--text-secondary);
  text-wrap: pretty;
}

.lede::before {
  content: "";
  display: block;
  width: 2rem;
  height: 2px;
  margin-bottom: 1.25rem;
  background: var(--accent);
}

.facts {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  letter-spacing: 0.004em;
  color: var(--text-secondary);
  text-wrap: pretty;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-primary);
  font: 500 0.9375rem/1.6 var(--font-text);
  letter-spacing: 0.004em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur-open) var(--ease),
    border-color var(--dur-open) var(--ease),
    color var(--dur-open) var(--ease),
    transform var(--dur-press) var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--on-primary);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    background: var(--text-secondary);
    border-color: var(--text-secondary);
    color: var(--on-primary);
  }
}

.save {
  width: 100%;
  min-height: 3.25rem;
  margin-top: 1.5rem;
}

.hint {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.462;
  letter-spacing: 0.01em;
  color: var(--text-tertiary);
  text-align: center;
}

.share {
  width: 100%;
  margin-top: 2rem;
}

/* Link rows */

.group {
  margin-top: 2rem;
}

.label {
  font-weight: 500;
  font-size: 0.75rem;
  line-height: 1.333;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.rows {
  margin-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 1rem;
  min-height: 3.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.rows li:last-child .row {
  border-bottom: 0;
}

.row__label {
  grid-column: 1;
  font-size: 0.8125rem;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--text-tertiary);
}

.row__value {
  grid-column: 1;
  font-size: 1.0625rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-decoration: underline 1px var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-open) var(--ease);
}

.row__icon {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: var(--text-tertiary);
  transition:
    transform var(--dur-open) var(--ease),
    color var(--dur-open) var(--ease);
}

.row:active .row__value {
  text-decoration-color: var(--text-primary);
}

.row:active .row__icon {
  color: var(--text-primary);
  transform: translate(2px, -2px);
}

@media (hover: hover) and (pointer: fine) {
  .row:hover .row__value {
    text-decoration-color: var(--accent);
  }

  .row:hover .row__icon {
    color: var(--text-primary);
    transform: translate(2px, -2px);
  }
}

/* Theme toggle: the brand's half-filled circle. 44px rather than the brand's 40px, for the touch-target rule. */

.top__tools {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.theme {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur-open) var(--ease),
    color var(--dur-open) var(--ease);
}

.theme[hidden] {
  display: none;
}

.theme:active {
  background: var(--text-secondary);
  color: var(--surface);
}

.theme__mark {
  width: 1rem;
  height: 1rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: linear-gradient(to right, currentColor 0 50%, transparent 50% 100%);
  transition: transform var(--dur-open) var(--ease);
}

:root[data-theme="dark"] .theme__mark {
  transform: rotate(180deg);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme__mark {
    transform: rotate(180deg);
  }
}

/* Tooltip for mouse users only; on touch the label is the accessible name. */
@media (hover: hover) and (pointer: fine) {
  .theme:hover {
    background: var(--border);
  }

  .theme::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 30;
    padding: 0.5rem 0.75rem;
    border-radius: 2px;
    background: var(--text-primary);
    color: var(--surface);
    font: 400 0.8125rem/1.3 var(--font-text);
    letter-spacing: 0.006em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-2px);
    transition:
      opacity var(--dur-open) var(--ease),
      transform var(--dur-open) var(--ease);
  }

  .theme:hover::after,
  .theme:focus-visible::after {
    opacity: 1;
    transform: none;
  }
}

/* Language menu */

.lang {
  position: relative;
}

.lang__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 2.75rem;
  padding: 0 0.5rem 0 0.75rem;
  border-radius: var(--radius-control);
  font-weight: 500;
  font-size: 0.9375rem;
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-open) var(--ease);
}

.lang__toggle:active,
.lang__menu a:active {
  background: var(--surface-hover);
}

.lang__toggle::-webkit-details-marker {
  display: none;
}

.lang__chevron {
  transition: transform var(--dur-open) var(--ease);
}

.lang[open] .lang__chevron {
  transform: rotate(180deg);
}

@media (hover: hover) and (pointer: fine) {
  .lang__toggle:hover {
    background: var(--surface-hover);
  }
}

.lang__menu {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.25rem);
  right: 0;
  min-width: 11rem;
  padding: 0.25rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 40px rgba(9, 9, 11, 0.1);
  transform-origin: top right;
  animation: menu-in var(--dur-open) var(--ease);
  --text-tertiary: var(--text-tertiary-raised);
}

.lang__menu a {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border-radius: var(--radius-control);
  color: inherit;
  text-decoration: none;
  transition: background-color var(--dur-press) var(--ease);
}

/* Current language: brand selection wash plus a check, not colour alone. */
.lang__menu a[aria-current="page"] {
  justify-content: space-between;
  gap: 1rem;
  font-weight: 500;
  background: var(--surface-selected);
}

.lang__menu a[aria-current="page"]::after {
  content: "";
  width: 0.375rem;
  height: 0.75rem;
  margin: -0.25rem 0.25rem 0 0;
  border: solid currentColor;
  border-width: 0 1.75px 1.75px 0;
  transform: rotate(45deg);
}

@media (hover: hover) and (pointer: fine) {
  .lang__menu a:hover {
    background: var(--surface-hover);
  }
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
  }
}

/* Share dialog */

.sheet {
  width: min(100% - 2rem, 26rem);
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface-raised);
  color: var(--text-primary);
  --text-tertiary: var(--text-tertiary-raised);
  /* Exit is quicker than entry. Browsers without allow-discrete just snap. */
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 140ms var(--ease),
    transform 140ms var(--ease),
    overlay 140ms allow-discrete,
    display 140ms allow-discrete;
}

.sheet[open] {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  opacity: 1;
  transform: none;
  transition-duration: var(--dur-open);
}

.sheet::backdrop {
  background: var(--backdrop);
  opacity: 0;
  transition:
    opacity 140ms var(--ease),
    overlay 140ms allow-discrete,
    display 140ms allow-discrete;
}

.sheet[open]::backdrop {
  opacity: 1;
  transition-duration: var(--dur-open);
}

@starting-style {
  .sheet[open] {
    opacity: 0;
    transform: translateY(8px);
  }

  .sheet[open]::backdrop {
    opacity: 0;
  }
}

.sheet__title {
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.006em;
}

.sheet__url {
  width: 100%;
  min-height: 3rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: inherit;
  font: 350 1rem/1.4 var(--font-text);
}

.sheet__status {
  min-height: 1.5em;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.btn--primary[data-state="done"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

.sheet form,
.sheet .btn {
  width: 100%;
}

/* Footer */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 1.5rem;
  margin-top: 1.5rem;
}

.foot__link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-tertiary);
  font: 400 0.8125rem/1.462 var(--font-text);
  letter-spacing: 0.01em;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 0.25em;
  cursor: pointer;
  transition: color var(--dur-open) var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .foot__link:hover {
    color: var(--text-primary);
  }
}

/* Privacy note */

.prose p {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  letter-spacing: 0.004em;
  color: var(--text-secondary);
  text-wrap: pretty;
}

.prose p a {
  color: var(--text-primary);
  text-underline-offset: 0.2em;
}

.prose .name + p {
  margin-top: 1.25rem;
}

.prose__heading {
  margin-top: 2rem;
}

.back {
  width: 100%;
  margin-top: 2rem;
}

/* Consent bar: fixed and compact, so "Save my contact" stays visible above it at 390×844. */

.consent {
  position: fixed;
  inset: auto 0 0;
  z-index: 10;
  padding:
    0.75rem
    max(1rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  background: var(--surface-raised);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(9, 9, 11, 0.06);
  opacity: 1;
  transition:
    opacity 160ms var(--ease),
    display 160ms allow-discrete;
}

.consent[hidden] {
  display: none;
  opacity: 0;
}

@starting-style {
  .consent {
    opacity: 0;
  }
}

/* Keep the end of the page reachable while the bar is showing. */
body:has(.consent:not([hidden])) .page {
  padding-bottom: 8rem;
}

.consent__inner {
  max-width: 28rem;
  margin-inline: auto;
}

.consent__text {
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.333;
  color: var(--text-primary);
}

.consent__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.consent__link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-right: auto;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-underline-offset: 0.25em;
}

/* Equal weight for both choices. */
.consent__btn {
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
}

@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;
  }

  .btn:active,
  .row:active .row__icon,
  .row:hover .row__icon,
  .theme::after,
  .sheet {
    transform: none;
  }
}
