/* LifeKor — main stylesheet (moved out of index.html) */

/* ============ Design tokens (fluid: 320px → 600px+) ============ */
:root{
  --blue:#1257e6; --blue-d:#0b45c4; --navy:#0f1d3d; --text:#1b2333;
  --page:#f4f7fc; /* page background: same tone as the bottom of the hero */
  --muted:#4a5468; --line:#e3e8f1; --red:#e53935;

  --app-max:600px;
  --gutter:clamp(10px, 3.4vw, 20px);
  --gap:clamp(6px, 2vw, 12px);
  --radius:clamp(10px, 3vw, 16px);

  --fs-h1:clamp(25px, 8.2vw, 40px);
  --fs-h2:clamp(17px, 5vw, 23px);
  --fs-h3:clamp(15px, 4.4vw, 21px);
  --fs-body:clamp(12px, 3.5vw, 16px);
  --fs-sm:clamp(11px, 3.1vw, 14px);
  --fs-xs:clamp(10px, 2.7vw, 13px);

  --nav-h:60px;
  /* height-aware spacing: shrinks on short screens so key menus fit the first screen */
  --hero-pt:clamp(10px, min(6vw, 3vh), 36px);
  --hero-pb:clamp(56px, min(19vw, 11vh), 96px);
  --sec-pt:clamp(9px, min(4.6vw, 2.3vh), 24px);
  --tile-h:clamp(70px, min(26vw, 15vh), 124px);
  --safe-t:env(safe-area-inset-top, 0px);
  --safe-b:env(safe-area-inset-bottom, 0px);
  --safe-l:env(safe-area-inset-left, 0px);
  --safe-r:env(safe-area-inset-right, 0px);
}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{
  -webkit-text-size-adjust:100%;text-size-adjust:100%;
  background:#e9edf4;
}
body{
  font-family:"Pretendard","Inter",-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo","Segoe UI",Roboto,"Noto Sans KR",sans-serif;
  color:var(--text);background:#e9edf4;
  -webkit-font-smoothing:antialiased;
  -webkit-tap-highlight-color:transparent;
  overscroll-behavior-y:none;
}
img,svg{display:block;max-width:100%}
a{color:inherit;text-decoration:none}
button{font:inherit;border:0;background:none;cursor:pointer;color:inherit}
a,button{touch-action:manipulation}
:focus-visible{outline:2px solid var(--blue);outline-offset:2px;border-radius:6px}

.app{
  width:100%;max-width:var(--app-max);margin:0 auto;background:var(--page);
  min-height:100vh;min-height:100dvh;
  position:relative;overflow-x:hidden;overflow-x:clip; /* clip (not hidden) keeps the sticky header working */
  padding-bottom:calc(var(--nav-h) + var(--safe-b) + 8px);
  padding-left:var(--safe-l);padding-right:var(--safe-r);
}

/* ============ Header (sticky, under notch / Dynamic Island) ============ */
.header{
  position:sticky;top:0;z-index:20;
  display:flex;align-items:center;justify-content:space-between;
  padding:calc(var(--safe-t) + 10px) calc(var(--gutter) + 6px) 10px;
  background:rgba(255,255,255,.92);
  -webkit-backdrop-filter:saturate(180%) blur(12px);backdrop-filter:saturate(180%) blur(12px);
  transition:box-shadow .2s;
}
.header.scrolled{box-shadow:0 1px 0 var(--line)}
.logo{font-size:clamp(21px, 6.4vw, 28px);font-weight:800;letter-spacing:-.5px;color:var(--navy);position:relative;line-height:1.2}
.logo span{color:var(--blue)}
.header-actions{display:flex;align-items:center;gap:clamp(6px,2.5vw,14px)}
.lang{display:flex;align-items:center;gap:6px;font-size:var(--fs-body);font-weight:500;min-height:44px}
.sos{
  display:flex;align-items:center;justify-content:center;gap:5px;
  height:36px;min-width:36px;padding:0 11px 0 9px;border-radius:999px;
  background:#fdecec;border:1px solid #f7cfcf;color:var(--red);
  font-size:13px;font-weight:800;letter-spacing:.3px;
}
.sos:active{background:#f9d3d3}

/* ============ Hero ============ */
.hero{
  position:relative;
  padding:var(--hero-pt) calc(var(--gutter) + 6px) var(--hero-pb);
  background:linear-gradient(180deg,#e8f1fe 0%,#eaf2fd 70%,var(--page) 100%);
  overflow:hidden;
}
.hero h1{font-size:min(var(--fs-h1), 5.4vh);line-height:1.12;font-weight:800;letter-spacing:-.03em;color:var(--navy);position:relative;z-index:2}
.hero h1 em{font-style:normal;color:var(--blue)}
.hero p{margin-top:10px;font-size:var(--fs-sm);color:#2f394d;position:relative;z-index:2;max-width:62%}
/* Hero illustration: anchored bottom-right at full hero height; the plain left side
   of the image sits behind the headline, the tiger stays on the right */
.hero-art{
  position:absolute;right:0;z-index:1;pointer-events:none;
  /* image bottom stops just under the search bar's top edge so the tiger isn't hidden */
  bottom:calc(var(--hero-pb) * .6);height:calc(100% - var(--hero-pb) * .6 + 6px);width:auto;max-width:none;
  transform:translateX(var(--art-shift, 9%));
  -webkit-mask-image:linear-gradient(180deg,#000 82%,transparent 100%);mask-image:linear-gradient(180deg,#000 82%,transparent 100%);
}

/* ============ Search ============ */
.search{
  margin:calc(var(--hero-pb) * -0.72) var(--gutter) 0;position:relative;z-index:6;
  display:flex;align-items:center;gap:10px;
  background:#fff;border:1px solid var(--line);border-radius:14px;
  padding:6px 6px 6px 14px;box-shadow:0 6px 18px rgba(20,40,90,.07);
}
.search > svg{flex:0 0 auto;width:clamp(18px,5.5vw,22px)}
/* 16px+ prevents iOS auto-zoom on focus */
.search input{flex:1;border:0;outline:0;font:inherit;font-size:16px;color:var(--text);background:transparent;min-width:0;height:40px;-webkit-appearance:none;appearance:none}
.search input::-webkit-search-cancel-button{-webkit-appearance:none}
.search input::placeholder{color:#6b7385}
.search > button{flex:0 0 auto;width:clamp(44px,13vw,56px);height:40px;border-radius:9px;background:var(--blue);display:grid;place-items:center}
.suggest{
  position:absolute;left:0;right:0;top:calc(100% + 6px);z-index:15;
  background:#fff;border:1px solid var(--line);border-radius:14px;
  box-shadow:0 10px 28px rgba(20,40,90,.14);padding:6px;
}
.suggest-ai{width:100%;display:flex;align-items:center;gap:12px;padding:10px;border-radius:10px;text-align:left;min-height:52px}
.suggest-ai:hover,.suggest-ai:focus-visible{background:#f2f6fe}
.ai-ic{flex:0 0 auto;width:34px;height:34px;border-radius:10px;background:#e8f0fd;display:grid;place-items:center}
.suggest-txt{flex:1;min-width:0;font-size:14px;color:var(--navy)}
.suggest-txt b{display:block;font-weight:700;color:var(--blue)}
.suggest-txt span{display:block;font-size:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.search:focus-within{border-color:var(--blue);box-shadow:0 0 0 3px rgba(18,87,230,.15)}

/* ============ Quick-link chips ============
   Wide screens: natural widths, centered as a group.
   Narrow screens: icons hidden, 3 equal-width buttons fill the row (no sideways scroll,
   nothing cut off); on the very narrowest screens a label may wrap to 2 centered lines. */
.chips{
  position:relative;z-index:4;
  display:grid;grid-template-columns:repeat(3,minmax(0,max-content));justify-content:center;
  gap:var(--gap);padding:clamp(12px,2.6vh,20px) var(--gutter) 5px;
}
.chip{
  display:flex;align-items:center;justify-content:center;gap:6px;
  border:1px solid #d7deea;border-radius:999px;padding:4px clamp(8px,3vw,16px);min-height:40px;
  font-size:var(--fs-sm);font-weight:500;line-height:1.15;background:#fff;text-align:center;
}
.chip svg{flex:0 0 auto}
/* Narrow phones: not enough room for icon + label on one line,
   so drop the icons and give the 3 buttons equal width across the row */
@media (max-width:539px){
  .chips{grid-template-columns:repeat(3,minmax(0,1fr))}
  .chip svg{display:none}
  .chip{padding:4px 6px}
}
@media (max-width:360px){
  .chips{gap:6px}
  .chip{padding:4px 3px}
}

/* ============ Explore grid ============ */
.section-title{font-size:var(--fs-h2);font-weight:800;letter-spacing:-.02em;color:var(--navy);padding:var(--sec-pt) calc(var(--gutter) + 6px) clamp(8px,1.5vh,12px)}
.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:1fr;gap:var(--gap);padding:0 var(--gutter)}
.tile{
  background:#fff;border:1px solid #edf0f5;border-radius:var(--radius);
  box-shadow:0 3px 10px rgba(20,40,90,.06);
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:clamp(6px,2.4vw,12px);padding:clamp(12px,4vw,20px) 4px;
  min-height:var(--tile-h);text-align:center;
  font-weight:700;font-size:clamp(12px,3.6vw,16px);line-height:1.15;color:var(--navy);
  transition:transform .15s, box-shadow .15s;
}
.tile svg{flex:0 0 auto;height:clamp(28px,min(10.5vw,6vh),52px);width:auto}
.tile:active{transform:scale(.97)}
@media (hover:hover){ .tile:hover{transform:translateY(-2px);box-shadow:0 6px 16px rgba(20,40,90,.1)} }

/* ============ Banner ============ */
.banner{
  margin:clamp(12px,4vw,20px) var(--gutter) 0;border-radius:var(--radius);
  padding:clamp(12px,3.6vw,20px) clamp(14px,4vw,22px);
  padding-right:clamp(100px, 30vw, 170px);
  /* flat light-blue card with a thin border instead of a shadow: clear edge, keeps the blue CTA prominent */
  background:#E8F0FE;border:1px solid #C7D8F4;
  position:relative;overflow:hidden;
}
/* the title only wraps between meaning units: "Your first weeks," / "step by step" */
.banner h3 .nowrap{display:inline-block;white-space:nowrap}
.banner .eyebrow{font-size:var(--fs-xs);font-weight:800;color:var(--blue);letter-spacing:.3px}
.banner h3{font-size:var(--fs-h3);line-height:1.2;font-weight:800;color:var(--navy);margin-top:6px;letter-spacing:-.02em}
.banner p{font-size:var(--fs-xs);color:#3a4357;margin-top:4px}
.btn-primary{
  margin-top:10px;display:inline-flex;align-items:center;gap:8px;
  background:var(--blue);color:#fff;font-weight:600;font-size:var(--fs-sm);
  padding:0 14px;min-height:38px;border-radius:6px;
}
.btn-primary:active{background:var(--blue-d)}
.banner-art{position:absolute;right:clamp(8px,3vw,20px);top:50%;transform:translateY(-50%);width:clamp(84px, 26vw, 140px)}

/* ============ Guides ============ */
.row-head{display:flex;align-items:center;justify-content:space-between;padding:clamp(18px,5.5vw,28px) calc(var(--gutter) + 6px) 10px}
.row-head h2{font-size:var(--fs-h2);font-weight:800;color:var(--navy);letter-spacing:-.02em}
.row-head a{color:var(--blue);font-size:var(--fs-sm);font-weight:500;display:flex;align-items:center;gap:4px;min-height:44px}
.guides{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--gap);padding:0 var(--gutter) clamp(16px,4vw,24px)}
.guide{background:#fff;border-radius:var(--radius);overflow:hidden;box-shadow:0 3px 10px rgba(20,40,90,.07);border:1px solid #eef1f6}
.guide .thumb{aspect-ratio:200 / 82;position:relative;overflow:hidden}
.guide .thumb img{width:100%;height:100%;object-fit:cover;display:block;background:#e9edf3}
.guide .body{padding:clamp(8px,2.6vw,14px) clamp(10px,3vw,14px) clamp(10px,3vw,14px)}
.guide .t{display:flex;justify-content:space-between;align-items:flex-start;gap:6px;font-weight:700;font-size:var(--fs-body);color:var(--navy)}
/* title area is always two lines tall (longer titles are clamped to 2 lines),
   so "Sources & updates" sits at the same height on every card */
.guide .t .title{flex:1;min-width:0;line-height:1.25;min-height:2.5em;
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden}
.guide .t button{flex:0 0 auto;width:32px;height:32px;margin:calc(.625em - 16px) -6px 0 0;display:grid;place-items:center}
.guide .t button.on svg{fill:var(--blue);stroke:var(--blue)}
.guide .s{display:inline-flex;align-items:center;gap:4px;color:var(--blue);font-size:var(--fs-xs);margin-top:6px}



/* ============ Bottom tab bar (home-indicator safe) ============ */
.nav{
  position:fixed;bottom:0;left:50%;transform:translateX(-50%);z-index:30;
  width:100%;max-width:var(--app-max);
  display:grid;grid-template-columns:repeat(4,1fr);
  padding:0 var(--safe-r) var(--safe-b) var(--safe-l);
  background:rgba(255,255,255,.95);
  -webkit-backdrop-filter:saturate(180%) blur(12px);backdrop-filter:saturate(180%) blur(12px);
  border-top:1px solid var(--line);
  -webkit-user-select:none;user-select:none;
}
.nav a{height:var(--nav-h);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-size:var(--fs-xs);color:#7a8295}
.nav a svg{width:22px;height:22px}
.nav a.active{color:var(--blue)}
.nav a.active svg [data-fill]{fill:currentColor}
.nav a.active svg .spark{fill:#fff}

/* ============ Breakpoints ============ */

/* Very small phones (iPhone SE 1st gen, Galaxy Fold cover screen ~280–340px) */
@media (max-width:340px){
  .hero h1{font-size:23px}
  :root{--art-shift:14%}
  .hero p{max-width:55%}
  .lang .lang-txt,.lang svg:last-child{display:none}
  .sos{padding:0 9px}
  .banner{padding-right:84px}
  .banner-art{width:72px}
}

/* Large phones / foldables unfolded / small tablets: 6-column explore grid */
@media (min-width:560px){
  .grid{grid-template-columns:repeat(6,minmax(0,1fr))}
  :root{--tile-h:clamp(78px, 15vh, 112px)}
  .tile{font-size:14px}
  .tile svg{height:clamp(30px,5.5vh,44px)}
}

/* Tablets & desktop: centered app column, like Instagram web */
@media (min-width:600px){
  :root{
    --fs-h1:40px; --fs-h2:23px; --fs-h3:20px; --fs-body:16px; --fs-sm:14px; --fs-xs:13px;
    --gutter:20px; --gap:12px; --radius:16px;
  }
  body{padding:0}
  .app{box-shadow:0 0 0 1px var(--line),0 10px 40px rgba(20,40,90,.08)}
  :root{--hero-pb:clamp(60px, 11vh, 96px); --hero-pt:clamp(14px, 3.5vh, 36px)}
  .guides{grid-template-columns:repeat(2,minmax(0,1fr))}
  .nav{border-left:1px solid var(--line);border-right:1px solid var(--line)}
}
@media (min-width:1024px){
  :root{--app-max:640px}
  body{padding:24px 0 0}
  .app{border-radius:24px 24px 0 0}
  /* Rounded header corners: when the sticky header sits over scrolling content, the corners
     must show the page backdrop, not the content underneath. ::before fills the full rectangle
     with the backdrop colour, ::after paints the white rounded header on top of it. */
  .header{background:none;-webkit-backdrop-filter:none;backdrop-filter:none}
  .header::before,.header::after{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none}
  .header::before{background:#e9edf4}
  .header::after{background:#fff;border-radius:24px 24px 0 0}
  .header.scrolled{box-shadow:none}
  .header.scrolled::after{box-shadow:0 1px 0 var(--line)}
}

/* ===== Tablets & wide screens (iPad, Surface, laptops) =====
   Like Instagram / Toss on tablets: use a wider column and scale type, controls and spacing up,
   instead of showing a shrunken phone layout in the middle of a big screen. */
@media (min-width:768px){
  :root{
    --app-max:820px;
    --fs-h1:52px; --fs-h2:28px; --fs-h3:24px; --fs-body:18px; --fs-sm:16px; --fs-xs:14px;
    --gutter:28px; --gap:16px; --radius:20px; --nav-h:68px;
    --hero-pt:clamp(20px, 4vh, 56px); --hero-pb:clamp(72px, 11vh, 124px);
    --sec-pt:clamp(14px, 2.4vh, 30px); --tile-h:clamp(104px, 14vh, 156px);
  }
  .logo{font-size:32px}
  .lang{font-size:17px}
  .sos{height:40px;padding:0 14px 0 12px;font-size:14px}
  .sos svg{width:17px;height:17px}
  .hero p{font-size:18px;margin-top:14px}
  .search{padding:8px 8px 8px 20px;border-radius:16px}
  .search > svg{width:24px}
  .search input{height:48px;font-size:18px}
  .search > button{width:64px;height:48px;border-radius:12px}
  .chip{min-height:48px;padding:4px 20px;gap:8px;font-size:16px}
  .chip svg{width:20px;height:20px}
  .section-title{padding-bottom:16px}
  .tile{font-size:17px;gap:14px}
  .tile svg{height:clamp(40px, 6vh, 60px)}
  .banner{padding:28px 32px;padding-right:230px}
  .banner-art{width:170px;right:36px}
  .btn-primary{min-height:46px;padding:0 20px;font-size:16px;margin-top:16px}
  .row-head a{font-size:16px}
  .guide .body{padding:16px 18px 18px}
  .guide .t{font-size:19px}
  .guide .t button{width:40px;height:40px;margin-top:calc(.625em - 20px)}
  .guide .t button svg{width:20px;height:22px}
  .guide .s{font-size:14px;margin-top:8px}
  .nav a{font-size:13px;gap:4px}
  .nav a svg{width:26px;height:26px}
}
@media (min-width:1200px){
  :root{--app-max:880px}
}

/* Landscape phones (short viewport): compact hero, tighter nav */
@media (orientation:landscape) and (max-height:500px){
  :root{--nav-h:48px; --app-max:760px}
  .grid{grid-template-columns:repeat(6,minmax(0,1fr))}
  .guides{grid-template-columns:repeat(2,minmax(0,1fr))}
  .nav a{flex-direction:row;gap:8px}
}

/* ===== Short screens: keep logo + search + quick links + 6 categories on the first screen ===== */
@media (max-height:700px){
  .header{padding-top:calc(var(--safe-t) + 6px);padding-bottom:6px}
  .hero p{margin-top:6px}
}
@media (max-height:620px){
  .hero p{display:none}
  .tile{gap:6px}
}
/* very short (iPhone SE/8 in Safari, SE 1st gen, landscape phones): drop the illustration */
@media (max-height:570px){
  :root{--hero-pb:58px; --hero-pt:8px}
  .hero-art{display:none}
  .hero h1{font-size:22px}
  .hero h1 br{display:none}
  .header{padding-top:calc(var(--safe-t) + 2px);padding-bottom:2px}
  .tile{padding:8px 4px;gap:4px;font-size:12.5px}
  :root{--tile-h:68px}
  .tile svg{height:26px}
  .chip{min-height:36px}
}
@media (max-height:400px){
  :root{--hero-pb:6px; --hero-pt:0px}
  .hero h1{display:none}
  .search{margin-top:6px}
  .section-title{font-size:16px}
}

/* ============ Emergency bottom sheet ============ */
.sheet-backdrop{position:fixed;inset:0;background:rgba(15,29,61,.45);z-index:50;opacity:0;pointer-events:none;transition:opacity .2s}
.sheet{
  position:fixed;left:50%;bottom:0;z-index:51;width:100%;max-width:var(--app-max);
  transform:translate(-50%,100%);visibility:hidden;transition:transform .25s ease,visibility 0s .25s;
  background:#fff;border-radius:20px 20px 0 0;
  padding:10px calc(var(--gutter) + 6px + var(--safe-r)) calc(16px + var(--safe-b)) calc(var(--gutter) + 6px + var(--safe-l));
  max-height:85dvh;overflow-y:auto;overscroll-behavior:contain;
}
.sheet.open{transform:translate(-50%,0);visibility:visible;transition:transform .25s ease}
.sheet.open + .sheet-backdrop, .sheet-backdrop.open{opacity:1;pointer-events:auto}
.sheet .grab{width:40px;height:4px;border-radius:2px;background:#d5dbe6;margin:0 auto 12px}
.sheet h2{font-size:18px;font-weight:800;color:var(--navy);display:flex;justify-content:space-between;align-items:center}
.sheet h2 button{width:36px;height:36px;display:grid;place-items:center;margin-right:-8px}
.sheet .sub{font-size:13px;color:var(--muted);margin:4px 0 12px}
.sheet ul{list-style:none;display:grid;gap:8px}
.sheet li a{display:flex;align-items:center;gap:12px;padding:10px 12px;border:1px solid var(--line);border-radius:12px;min-height:56px}
.sheet li a:active{background:#f5f7fb}
.sheet .num{flex:0 0 auto;width:5.4em;font-weight:800;font-size:16px;color:var(--red);font-variant-numeric:tabular-nums}
.sheet .lbl{flex:1;font-size:14px;font-weight:600;color:var(--navy)}
.sheet .lbl small{display:block;font-weight:400;font-size:12px;color:var(--muted);margin-top:2px}
.sheet .call{flex:0 0 auto;width:36px;height:36px;border-radius:50%;background:#fdecec;display:grid;place-items:center}
body.sheet-open{overflow:hidden}

/* Standalone (installed web app) */
@media (display-mode:standalone){
  html,body{background:var(--page)}
}

@media (prefers-reduced-motion:reduce){
  *{transition:none!important;animation:none!important;scroll-behavior:auto!important}
}
